Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Java Error that i cant work out

  1. #1
    Join Date
    Oct 2007
    Posts
    7

    Default Java Error that i cant work out

    i have this error that i receive on several lines when importing a text file.

    -----
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : Unexpected error :
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : org.pentaho.di.core.exception.KettleValueException:
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : Javascript error:
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : The choice of Java constructor setValue matching JavaScript argument types (null) is ambiguous; candidate constructors are:
    void setValue(java.math.BigDecimal)
    void setValue(java.lang.StringBuffer)
    void setValue(byte[])
    void setValue(java.util.Date)
    void setValue(org.pentaho.di.compatibility.Value)
    void setValue(java.lang.String)
    void setValue(java.lang.Boolean) (script#5)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) :
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:445)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.processRow(ScriptValuesMod.java:735)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.run(ScriptValuesMod.java:796)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : Caused by: org.mozilla.javascript.EvaluatorException: The choice of Java constructor setValue matching JavaScript argument types (null) is ambiguous; candidate constructors are:
    void setValue(java.math.BigDecimal)
    void setValue(java.lang.StringBuffer)
    void setValue(byte[])
    void setValue(java.util.Date)
    void setValue(org.pentaho.di.compatibility.Value)
    void setValue(java.lang.String)
    void setValue(java.lang.Boolean) (script#5)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:98)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.Context.reportRuntimeError(Context.java:966)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1022)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.Context.reportRuntimeError3(Context.java:1000)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.NativeJavaMethod.findFunction(NativeJavaMethod.java:385)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:156)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.gen.c36._c0(script:5)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.gen.c36.call(script)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.gen.c36.call(script)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.mozilla.javascript.gen.c36.exec(script)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:359)
    2007/11/05 10:21:57 - Fix Shipping Address.0 - ERROR (version 3.0.0-RC1, build 299003 from 2007/10/01 23:14:52) : ... 2 more

    -----

    The code it is referencing is (Fix shipping Address)

    if
    (trim(SpecialOrderCustomerShipToAddress.getString()) == 'NA' && WebOrderID.getString() == '000000')
    {
    ShipToName.setValue(SpecialOrderCustomerName.
    replace("M-O ",""))
    ShipToAddress.setValue(SpecialOrderCustomerAddress.getString())
    ShipToCity.setValue(SpecialOrderCustomerCity.getString())
    ShipToState.setValue(SpecialOrderCustomerSt.getString())
    ShipToZip.setValue(SpecialOrderCustomerZip.getString())
    }

    else if
    (trim(SpecialOrderCustomerShipToAddress.getString()) != 'NA')
    {
    ShipToName.setValue(SpecialOrderCustomerShipToName.
    replace("M-O ",""))
    ShipToAddress.setValue(SpecialOrderCustomerShipToAddress.getString())
    ShipToCity.setValue(SpecialOrderCustomerShipToCity.getString())
    ShipToState.setValue(SpecialOrderCustomerShipToState.getString())
    ShipToZip.setValue(SpecialOrderCustomerShipToZip.getString())

    }

    Can anyone point me in the right direction to fixing this?



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

    Default

    JavaScript is not a strongly typed language.
    As such, I don't know if there is a way to select a specific overloaded method using null.
    In Java you would typically cast it, but in JavaScript I doubt this is doable.

    The good solution, especially for version 3.0. is to abandon the use of the setValue() method.
    Because it can set any data type on the value, it can cause a difference between the data and the expected metadata. (that's also true for version 2 BTW).
    As such, it's a far better strategy to create new fields only.

    Modifying the values in-place is a dangerous game. Again, not because of something we do in PDI, but because of the flexible, loosely typed nature of JavaScript.

    HTH,

    Matt

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.