189189 case _ => templateScript
190190 })
191191
192- // if (snippetMode) {
193- // buffer ++= templateSnippet
194- // } else {
195- // if (numInputs > 0) {
196- // buffer ++= templateScriptMultiInput
197- // } else {
198- // buffer ++= templateScript
199- // }
200- // }
201192 script = buffer.toString()
202193
203194 if (snippetMode) {
214205 val outSpecs = configure(if (numInputs > 0 ) Array (inData(0 ).getDataTableSpec) else null )
215206 val outContainer = Array .tabulate(numOutputs) { i => new DataContainer (outSpecs(i)) }
216207
217- // val outContainer = Array.ofDim[DataContainer](numOutputs)
218- // for (i <- 0 to numOutputs - 1) {
219- // outContainer(i) = new DataContainer(outSpecs(i))
220- // }
221208 val fileSep = System .getProperty(" file.separator" )
222209 val core = Platform .getBundle(" org.knime.core" )
223210 val coreClassPath = core.getHeaders.get(" Bundle-Classpath" ).toString
@@ -236,32 +223,18 @@ end
236223 .map(s => FileLocator .find(core, new Path (s), null )).filter(_ != null )
237224 .map(FileLocator .resolve(_).getFile)
238225
239- // val classpath = new ArrayList[String]()
240- // for (s <- coreClassPath.split(",")) {
241- // val u = FileLocator.find(core, new Path(s), null)
242- // if (u != null) {
243- // classpath.add(FileLocator.resolve(u).getFile)
244- // }
245- // }
246226 classpath.add(corePluginPath + fileSep + " bin" )
247227 baseClassPath.split(" ," ).view
248228 .map(s => FileLocator .find(base, new Path (s), null )).filter(_ != null )
249229 .foreach { u => classpath.add(FileLocator .resolve(u).getFile) }
250230
251- // for (s <- baseClassPath.split(",")) {
252- // val u = FileLocator.find(base, new Path(s), null)
253- // if (u != null) {
254- // classpath.add(FileLocator.resolve(u).getFile)
255- // }
256- // }
257231 classpath.add(basePluginPath + fileSep + " bin" )
258232 classpath.add(getJavaClasspathExtensionPath)
259233 if (RubyScriptNodePlugin .getDefault.getPreferenceStore.getBoolean(PreferenceConstants .JRUBY_USE_EXTERNAL_GEMS )) {
260234 val str = RubyScriptNodePlugin .getDefault.getPreferenceStore.getString(PreferenceConstants .JRUBY_PATH )
261235 System .setProperty(" jruby.home" , str)
262236 }
263- var container : ScriptingContainer = null
264- container = new ScriptingContainer (LocalContextScope .THREADSAFE )
237+ var container = new ScriptingContainer (LocalContextScope .THREADSAFE )
265238 container.setCompatVersion(CompatVersion .RUBY2_0 )
266239 container.setCompileMode(CompileMode .JIT )
267240 container.setLoadPaths(classpath)
310283 exec.createBufferedDataTable(outContainer(i).getTable, exec)
311284 }
312285
313- // val result = Array.ofDim[BufferedDataTable](numOutputs)
314- // for (i <- 0 to numOutputs - 1) {
315- // outContainer(i).close()
316- // result(i) = exec.createBufferedDataTable(outContainer(i).getTable, exec)
317- // }
318286 result
319287 }
320288
404372 private def findErrorSource (thr : Throwable , filename : String ): Int = {
405373 val err = thr.getMessage
406374 if (err.startsWith(" (SyntaxError)" )) {
407- // val pLineS = Pattern.compile("(?<=:)(\\d+):(.*)")
408- // val mLine = pLineS.matcher(err)
409- // if (mLine.find()) {
410- // logger.debug("SyntaxError error line: " + mLine.group(1))
411- // script_error.text = if (mLine.group(2) == null) script_error.text else mLine.group(2)
412- // logger.debug("SyntaxError: " + script_error.text)
413- // script_error.lineNum = java.lang.Integer.parseInt(mLine.group(1))
414- // script_error.columnNum = -1
415- // script_error.`type` = "SyntaxError"
416- // }
417375 val pLineS = """ (?<=:)(\d+):(.*)""" .r
418376 err match {
419377 case pLineS(line, text) =>
427385 }
428386
429387 } else {
430- // val `type` = Pattern.compile("(?<=\\()(\\w*)")
431- // val mLine = `type`.matcher(err)
432- // if (mLine.find()) {
433- // script_error.`type` = mLine.group(1)
434- // }
435388 script_error.errType = """ (?<=\()(\w*)""" .r
436389 .findFirstMatchIn(err).map(_ group 2 ).getOrElse(script_error.errType)
437390
443396 script_error.columnNum = - 1
444397 script_error.lineNum = line.getLineNumber
445398 script_error.text = thr.getMessage
446- // val knimeType = Pattern.compile("(?<=org.knime.)(.*)(?=:)")
447- // val mKnimeType = knimeType.matcher(script_error.text)
448- // script_error.`type` =
449- // if (mKnimeType.find()) mKnimeType.group(1) else "RuntimeError"
450-
451399 script_error.errType = """ (?<=org.knime.)(.*)(?=:)""" .r
452400 .findFirstMatchIn(err).map(_ group 1 ).getOrElse(" RuntimeError" )
453401 // break
460408 (if (script_error.columnNum != - 1 ) " at column " + script_error.columnNum)
461409 })
462410
463- // if (script_error.lineNum != -1) {
464- // script_error.msg += " stopped with error in line " + script_error.lineNum
465- // if (script_error.columnNum != -1) {
466- // script_error.msg += " at column " + script_error.columnNum
467- // }
468- // } else {
469- // script_error.msg += "] stopped with error at line --unknown--"
470- // }
471411 if (script_error.errType == " RuntimeError" ) {
472412 logger.error(script_error.msg + " \n " + script_error.errType + " ( " + script_error.text + " )" )
473413 val cause = thr.getCause
0 commit comments