Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-18744

Expression Language equals with char results in NumberFormatException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Minor
    • None
    • 26.1.3.Final
    • EE
    • None
    • Hide

      In a JSP page use expression language "eq" to compare a String with a char.

      Show
      In a JSP page use expression language "eq" to compare a String with a char.
    • Hide

      The workaround is to append a ".toString()" to the char as it is autoboxed to a Character that can be forced to a String.

      Show
      The workaround is to append a ".toString()" to the char as it is autoboxed to a Character that can be forced to a String.
    • ---
    • ---

    Description

      When using the expression language "eq" with a String on the left and a char on the right Wildfly attempts to coerce the char to a long and fails with NumberFormatException.

      Stack trace looks like:

      Caused by: java.lang.NumberFormatException: For input string: "E"
          at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
          at java.base/java.lang.Long.parseLong(Long.java:711)
          at java.base/java.lang.Long.valueOf(Long.java:1163)
          at org.glassfish.jakarta.el@3.0.3.jbossorg-4//com.sun.el.lang.ELSupport.coerceToNumber(ELSupport.java:276)
          at org.glassfish.jakarta.el@3.0.3.jbossorg-4//com.sun.el.lang.ELSupport.coerceToNumber(ELSupport.java:258)
          at org.glassfish.jakarta.el@3.0.3.jbossorg-4//com.sun.el.lang.ELSupport.equals(ELSupport.java:125)
          at org.glassfish.jakarta.el@3.0.3.jbossorg-4//com.sun.el.parser.AstEqual.getValue(AstEqual.java:36)
          at org.glassfish.jakarta.el@3.0.3.jbossorg-4//com.sun.el.parser.AstChoice.getValue(AstChoice.java:41)
          at org.glassfish.jakarta.el@3.0.3.jbossorg-4//com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
          at org.jboss.weld.core@3.1.9.Final//org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
          at io.undertow.jsp@2.0.11.Final//org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:917)
          at org.apache.jsp.WEB_002dINF.views.codes.type_jsp._jspx_meth_c_005fforEach_005f0(type_jsp.java:232)
          at org.apache.jsp.WEB_002dINF.views.codes.type_jsp.access$7(type_jsp.java:211)
          at org.apache.jsp.WEB_002dINF.views.codes.type_jsp$Helper.invoke3(type_jsp.java:750)
          at org.apache.jsp.WEB_002dINF.views.codes.type_jsp$Helper.invoke(type_jsp.java:864)
          ... 137 more 

      Attachments

        Activity

          People

            bstansbe@redhat.com Brian Stansberry
            slominskir Ryan Slominski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: