Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Funny problem

  1. #1
    Join Date
    Sep 2005
    Posts
    1,403

    Default Funny problem

    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

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Funny problem

    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

  3. #3
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Funny problem

    April,


    I added tracker 2076 so you can see what were doing to help you out on this issue.



    Thanks for the feedback,



    Matt

  4. #4
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: Funny problem

    Thanks Matt,


    I really appreciate the prompt and extensive help. It is definitely a big pro for your product.



    April

  5. #5
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: Funny problem

    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

  6. #6
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Funny problem

    Yes well, I am working with the latest development snapshot. So, maybe you can give this one a swing? Just download kettle.jar 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

  7. #7
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: Funny problem

    Hi Matt,

    thanks, I will send you the XML as soon as I have tried this out.

    April

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.