View Full Version : Funny problem
kettle_anonymous
04-24-2006, 10:59 PM
Hi there,
I have defined a single step flow. The step is a Javascript step and it has the following code in it:
java;
var args = new Array(1);
args[0] = "";
Packages.mypackage.MyClass.main(args);
This works fine when I test the script but when I run the whole process I get the following index out of bounds exception:
"2006/04/25 07:58:58 - Java Script Value.0 - ERROR : Unexpected error in '-' : java.lang.IndexOutOfBoundsException: Index: 0, Size: 0"
Now, I am new to Kettle, in fact I am am busy evaluating it for our company. Please can you shed some light on this. If you need more info I will be more than happy to pass it on.
Thanks in advance
April
MattCasters
04-25-2006, 12:16 AM
Hi April,
There is a small Hello test program in be.ibridge.kettle.test that I use to try out the functionality.
So if I would use this:
<pre>
Packages.java;
var args = new Array(1);
args[0] = "";
Packages.be.ibridge.kettle.test.Hello.main(args);
</pre>
I tried this and it seems to work well. However, it is not using the arguments passed.
What might be a problem is the args[0] assigment. This is not assigning java.lang.String object, rather its passing JavaScript String objects. (don't know the class, sorry)
However, if you would do it like this, it would work better:
<pre>
args[0] = new Packages.java.lang.String("");
or
args[0] = someField.getString();
</pre>
Also, please note that no objects are retrievable from the JavaScript scope as args is an array and we don't support array retrieval (yet).
I hope you'll find this usefull and wish you lot's of fun with Kettle!
Kind regards,
Matt
MattCasters
04-25-2006, 12:25 AM
April,
I added tracker 2076 (http://www.javaforge.com/proj/tracker/itemDetails.do?task_id=2076) so you can see what were doing to help you out on this issue.
Thanks for the feedback,
Matt
kettle_anonymous
04-25-2006, 01:06 AM
Thanks Matt,
I really appreciate the prompt and extensive help. It is definitely a big pro for your product.
April
kettle_anonymous
04-25-2006, 01:15 AM
Hi Matt
I have tried this on both my class and the Hello class, they both work perfectly within the Javascript editor when I test them, but when I run the transform, they both give the out of bounds exception.
any ideas?
thanks
April
MattCasters
04-25-2006, 01:19 AM
Yes well, I am working with the latest development snapshot. So, maybe you can give this one a swing? Just download kettle.jar (http://www.javaforge.com/proj/doc/details.do?doc_id=3719) and install it in the lib/ directory of your Kettle distribution. (save the old kettle.jar if you like)
Just report back when you tried, and if possible, send me the XML of the JavaScript step, so I can have a look. (CTRL-C : copy to clipboard, gives you the XML)
Thanks,
Matt
kettle_anonymous
04-25-2006, 01:51 AM
Hi Matt,
thanks, I will send you the XML as soon as I have tried this out.
April