@@ -200,12 +200,12 @@ end
200200 override protected def execute (inData : Array [BufferedDataTable ], exec : ExecutionContext ): Array [BufferedDataTable ] = {
201201 var i : Int = 0
202202 val outSpecs = configure(if (numInputs > 0 ) Array (inData(0 ).getDataTableSpec) else null )
203- val outContainer = Array .ofDim[ DataContainer ] (numOutputs)
204- i = 0
205- while (i < numOutputs) {
206- outContainer(i) = new DataContainer (outSpecs(i))
207- i += 1
208- }
203+ val outContainer = Array .tabulate (numOutputs) { i => new DataContainer (outSpecs(i)) }
204+
205+ // val outContainer = Array.ofDim[DataContainer]( numOutputs)
206+ // for (i <- 0 to numOutputs - 1) {
207+ // outContainer(i) = new DataContainer(outSpecs(i))
208+ // }
209209 val fileSep = System .getProperty(" file.separator" )
210210 val core = Platform .getBundle(" org.knime.core" )
211211 val coreClassPath = core.getHeaders.get(" Bundle-Classpath" ).toString
@@ -219,20 +219,29 @@ end
219219 ext.append(basePluginPath + fileSep + " lib" )
220220 ext.append(corePluginPath + fileSep + " lib" )
221221 ext.append(getJavaExtDirsExtensionPath)
222- val classpath = new ArrayList [String ]()
223- for (s <- coreClassPath.split(" ," )) {
224- val u = FileLocator .find(core, new Path (s), null )
225- if (u != null ) {
226- classpath.add(FileLocator .resolve(u).getFile)
227- }
228- }
222+
223+ val classpath = coreClassPath.split(" ," ).view
224+ .map(s => FileLocator .find(core, new Path (s), null )).filter(_ != null )
225+ .map(FileLocator .resolve(_).getFile)
226+
227+ // val classpath = new ArrayList[String]()
228+ // for (s <- coreClassPath.split(",")) {
229+ // val u = FileLocator.find(core, new Path(s), null)
230+ // if (u != null) {
231+ // classpath.add(FileLocator.resolve(u).getFile)
232+ // }
233+ // }
229234 classpath.add(corePluginPath + fileSep + " bin" )
230- for (s <- baseClassPath.split(" ," )) {
231- val u = FileLocator .find(base, new Path (s), null )
232- if (u != null ) {
233- classpath.add(FileLocator .resolve(u).getFile)
234- }
235- }
235+ baseClassPath.split(" ," ).view
236+ .map(s => FileLocator .find(base, new Path (s), null )).filter(_ != null )
237+ .foreach { u => classpath.add(FileLocator .resolve(u).getFile) }
238+
239+ // for (s <- baseClassPath.split(",")) {
240+ // val u = FileLocator.find(base, new Path(s), null)
241+ // if (u != null) {
242+ // classpath.add(FileLocator.resolve(u).getFile)
243+ // }
244+ // }
236245 classpath.add(basePluginPath + fileSep + " bin" )
237246 classpath.add(getJavaClasspathExtensionPath)
238247 if (RubyScriptNodePlugin .getDefault.getPreferenceStore.getBoolean(PreferenceConstants .JRUBY_USE_EXTERNAL_GEMS )) {
@@ -288,13 +297,16 @@ end
288297 throw new CanceledExecutionException (e.getMessage)
289298 }
290299 }
291- val result = Array .ofDim[BufferedDataTable ](numOutputs)
292- i = 0
293- while (i < numOutputs) {
300+ val result = Array .tabulate(numOutputs) { i =>
294301 outContainer(i).close()
295- result(i) = exec.createBufferedDataTable(outContainer(i).getTable, exec)
296- i += 1
302+ exec.createBufferedDataTable(outContainer(i).getTable, exec)
297303 }
304+
305+ // val result = Array.ofDim[BufferedDataTable](numOutputs)
306+ // for (i <- 0 to numOutputs - 1) {
307+ // outContainer(i).close()
308+ // result(i) = exec.createBufferedDataTable(outContainer(i).getTable, exec)
309+ // }
298310 result
299311 }
300312
0 commit comments