Menu

#48 java.lang.Double.valueOf(D)Ljava/lang/Double;

closed-works-for-me
nobody
None
5
2007-02-28
2006-11-02
Anonymous
No

I used Retroweaver on a Java 1.5 JAR file (targeting
1.4), and here is what happened at runtime :

java.lang.NoSuchMethodError:
java.lang.Double.valueOf(D)Ljava/lang/Double;

A quick look at the javadoc reveals that this method
appears in Java 1.5.

Discussion

  • MoS

    MoS - 2006-11-02

    Logged In: YES
    user_id=1635915

    The version of Retroweaver used there was Retroweaver 2.0Beta2 (build 275).

     
  • MoS

    MoS - 2006-11-02

    Logged In: YES
    user_id=1635915

    To be more specific,
    this code is compiled in 1.5 :

    public Double getMinXValue()
    {
    return 6.0;
    }

    then weaved to 1.4. Once decompiled we have :

    public Double getMinXValue()
    {
    return Double.valueOf(6D);
    }

    which results in the above exception.

     
  • Xavier Le Vourch

    • status: open --> pending-works-for-me
     
  • Xavier Le Vourch

    Logged In: YES
    user_id=1373398

    I tried to reproduce the problem but the call is translated
    correctly:

    public java.lang.Double getMinXValue();
    Signature: ()Ljava/lang/Double;
    Code:
    0: ldc2_w #1; //double 6.0d
    3: invokestatic #23; //Method
    net/sourceforge/retroweaver/runtime/java/l
    ang/Double_.valueOf:(D)Ljava/lang/Double;
    6: areturn

    Could you provide a small example to reproduce the problem?

    Thanks,

    Xavier

     
  • MoS

    MoS - 2006-11-03

    Logged In: YES
    user_id=1635915

    Maybe that I extracted from the code the wrong line but I thought it was this one responsible for the
    problem.

    This exactly how I get this exception (and several others I posted) :

    - The goal is to have Apache Trinidad demo application working with Tomcat 5.0 and JDK 1.4 (my exact
    version 1.4.2_07).

    - Download http://people.apache.org/maven-snapshot-repository/org/apache/myfaces/trinidad/trinidad-
    demo/incubator-m1-SNAPSHOT/trinidad-demo-incubator-m1-SNAPSHOT.war into <Tomcat_Dir>/webapps

    - Restart then stop Tomcat so that the war file is expanded

    - Use Retroweaver 2.0Beta2 (build 275) on <Tomcat_Dir>/webapps/trinidad-demo-incubator-m1-SNAPSHOT/WEB-
    INF/lib/trinidad-api-incubator-m1-SNAPSHOT.jar and <Tomcat_Dir>/webapps/trinidad-demo-incubator-m1-
    SNAPSHOT/WEB-INF/lib/trinidad-impl-incubator-m1-SNAPSHOT.jar (for those 2 jar files, I used the
    Retroweaver ANT Task targeting 1.4)

    - Add retroweaver-rt-2.0Beta2.jar and backport-util-concurrent.jar in <Tomcat_Dir>/webapps/trinidad-
    demo-incubator-m1-SNAPSHOT/WEB-INF/lib/

    - Finally, Retroweaver 2.0Beta2 (build 275) has to be used on <Tomcat_Dir>/webapps/trinidad-demo-
    incubator-m1-SNAPSHOT/WEB-INF/classes/

    - Start Tomcat and test the application using a web browser on http://<host>:<port>/trinidad-demo-
    incubator-m1-SNAPSHOT/

    Here are all the problems I encountered while navigating this demo application :

    Component Guide > chart
    java.lang.NoSuchMethodError: java.lang.Double.valueOf(D)Ljava/lang/Double;
    at org.apache.myfaces.trinidaddemo.ChartBean$MyChartModel.<init>(ChartBean.java:337)
    at org.apache.myfaces.trinidaddemo.ChartBean$MyChartModel.<init>(ChartBean.java:129)
    at org.apache.myfaces.trinidaddemo.ChartBean.<init>(ChartBean.java:358)
    Then, once source code altered to avoid this error :
    java.lang.NoSuchMethodError: java.io.StringWriter.append(Ljava/lang/CharSequence;)Ljava/io/StringWriter;
    at
    org.apache.myfaces.trinidadinternal.renderkit.core.desktop.ChartRenderer._outputSVGDocumentCreate
    (ChartRenderer.java:211)

    Component Guide > goButton
    java.lang.NoSuchMethodError: java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)
    Ljava/lang/String;
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.GoButtonRenderer.getButtonOnclick
    (GoButtonRenderer.java:235)

    Component Guide >
    {selectManyCheckbox,selectManyListbox,selectManyShuttle,selectOneListbox,selectOrderShuttle}
    java.lang.NoSuchMethodError: java.lang.Integer.valueOf(I)Ljava/lang/Integer;
    at org.apache.myfaces.trinidaddemo.ListTestBean.<init>(ListTestBean.java:241)

    Component Guide > selectRangeChoiceBar
    java.lang.IllegalArgumentException: SelectItem with no value
    at org.apache.myfaces.shared_impl.taglib.core.SelectItemTagBase.setProperties
    (SelectItemTagBase.java:60)
    (This one is probably not due to Retroweaver)

    Component Guide > inputDate
    Feature Demos -> Converters and Validators -> message customization on validators and converters
    java.lang.NullPointerException
    at org.apache.myfaces.trinidadinternal.validator.DateTimeRangeValidator.getClientValidation
    (DateTimeRangeValidator.java:76)
    (This one is probaly due to a difference between 1.4 and 1.5 in the handling of a null value)

    Feature Demos -> Change Persistence Demos => Add, Remove or Reorder Children Change Demo - Explicit
    Change registration => Reorder children
    java.lang.NullPointerException
    at
    org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer._isParentPanelForm
    (LabelAndMessageRenderer.java:103)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer.encodeAll
    (LabelAndMessageRenderer.java:200)
    (Same as previous one)

    - Source code of trinidad-demo-incubator-m1-SNAPSHOT.war here : http://people.apache.org/maven-snapshot-
    repository/org/apache/myfaces/trinidad/trinidad-demo/incubator-m1-SNAPSHOT/trinidad-demo-incubator-m1-
    SNAPSHOT-sources.jar

    - Source code of trinidad-api-incubator-m1-SNAPSHOT.jar here : http://people.apache.org/maven-snapshot-
    repository/org/apache/myfaces/trinidad/trinidad-api/incubator-m1-SNAPSHOT/trinidad-api-incubator-m1-
    SNAPSHOT-sources.jar

    - Source code of trinidad-impl-incubator-m1-SNAPSHOT.jar here : http://people.apache.org/maven-snapshot-
    repository/org/apache/myfaces/trinidad/trinidad-impl/incubator-m1-SNAPSHOT/trinidad-impl-incubator-m1-
    SNAPSHOT-sources.jar

    Of course the demo works perfectly on Tomcat 5.5 and Java 1.5.
    I know you just asked me a "small example to reproduce the problem", and what I gave here was the whole
    process...
    But I already tried to extract the interesting lines from the source file, and it looks like I did it
    wrong because you couldn't reproduce the problem with it. And it might be useful because it illustrates
    a way to reproduce several problems I reported.
    But If you prefer the "small example" anyway, let me know, I will try to produce it.

     
  • MoS

    MoS - 2006-11-03
    • status: pending-works-for-me --> open-works-for-me
     
  • Xavier Le Vourch

    Logged In: YES
    user_id=1373398
    Originator: NO

    Sorry for the long delay... Another user found a similar problem and the issue seems to be that the retroweaver-rt-<version>.jar was not in the class path during the weaving process so the valueOf substitution wasn't picked up.

    Could you try to redo the weaving, making sure that the rt jar file is in the classpath?

    Thanks,

    Xavier

     
  • Xavier Le Vourch

    • status: open-works-for-me --> closed-works-for-me
     
  • MoS

    MoS - 2007-03-29

    Logged In: YES
    user_id=1635915
    Originator: NO

    Hi,
    We used a workaround for this part of the code (In the end it appeared that we had no use for it).
    Everything is now working as we wanted so I will not be able to modify it for the moment.
    So you can consider the problem as closed if this solution works and if nobody complains about it again
    Thanks for your time.

    MoS

     

Log in to post a comment.

MongoDB Logo MongoDB