Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-6382

ELSupport class throws exception when passing null value and Number type to coerceToNumber method

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • TBD EAP 5
    • EAP_EWP 5.1.0, EAP_EWP 5.1.1
    • Web
    • Hide

      When passing a 'null' reference and 'Number' type to the 'coerceToType' method an 'java.lang.IllegalArgumentException: Cannot convert 0 of type class java.lang.Long to class java.lang.Number' is thrown.

      Show
      When passing a 'null' reference and 'Number' type to the 'coerceToType' method an 'java.lang.IllegalArgumentException: Cannot convert 0 of type class java.lang.Long to class java.lang.Number' is thrown.
    • Release Notes
    • Hide
      When a 'null' reference and 'Number' type was passed to the 'coerceToType' method of the org.apache.el.lang.ELSupport class, the following error message was thrown:

      <screen>java.lang.IllegalArgumentException: Cannot convert 0 of type class java.lang.Long to class java.lang.Number</screen>.

      The cause of this issue was that the coerceToNumber method didn't first check if the 'type' was a Number class. This test has now been added, resolving this bug.
      Show
      When a 'null' reference and 'Number' type was passed to the 'coerceToType' method of the org.apache.el.lang.ELSupport class, the following error message was thrown: <screen>java.lang.IllegalArgumentException: Cannot convert 0 of type class java.lang.Long to class java.lang.Number</screen>. The cause of this issue was that the coerceToNumber method didn't first check if the 'type' was a Number class. This test has now been added, resolving this bug.
    • Documented as Resolved Issue
    • NEW

    Description

      We are currently porting their applications/framework from JBoss AS 6 to our supported JBoss EAP 5.1. During this exercise we found a bug in the org.apache.el.lang.ELSupport class. When passing a 'null' reference and 'Number' type to the 'coerceToType' method an 'java.lang.IllegalArgumentException: Cannot convert 0 of type class java.lang.Long to class java.lang.Number' is thrown. The bug is actually in the 'coerceToNumber(final Number number, final Class type)' method, which should check whether the 'type' is the Number class, and if it is, just return the 'number'.

      This issue has been fixed in the ELSupport class of Apache Tomcat 6.0.21. See also: https://issues.apache.org/bugzilla/show_bug.cgi?id=43656 (comment 26 to 29). I had a look at JBossWeb 2.1.11.GA, which is the new JBossWeb that will be included in EAP 5.1.1, but that version of JBossWeb still contains this bug.

      I've attached the stack trace, the ELSupport class of Tomcat 6.0.20 and the ELSupport class of Tomcat 6.0.21 (which includes the fix). The fix is at line numbers 249,250 and 251 in the 6.0.21 version of the class.

      Attachments

        1. ELSupport_6.0.20.java
          16 kB
        2. ELSupport_6.0.21.java
          16 kB
        3. jbossweb.jar
          2.43 MB
        4. patch.txt
          0.6 kB
        5. stacktrace.txt
          7 kB

        Activity

          People

            rmaucher Remy Maucherat
            rhn-support-jshepher Jason Shepherd
            Russell Dickenson Russell Dickenson (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: