1 Reply Latest reply on Sep 21, 2017 7:39 AM by wjzych

    Problem with rtexprvalue not being evaluated in a tagfile

    kopcheski

      I am working with an legacy JavaEE 5 application, which actually runs on JBoss 4.3 EAP, in order to be possible to run on Wildfly (10.1.0).

      Over many adjusts I had to made, there is one special case which I couldn't get over.

       

      The scenario is:

      - This tagfile (which I'll call mytagfile.tag) is placed inside a JAR and properly defined in a TLD.

       

      <%@ taglib uri="myuri" prefix="myprefix"%>

      <%@ taglib uri="http://java.sun.com/jsp/jstl/core"      prefix="c"%>

       

      <c:set var="value">200</c:set> <%-- just to illustrate the case --%>

       

      <myprefix:mytag

        attr1="planstring"

        attr2="${value}" />

       

      This is the TLD particle regarding "mytag"

       

      <?xml version="1.0" encoding="UTF-8"?>

      <taglib>

         <tlib-version>1.0</tlib-version>

         <jsp-version>1.2</jsp-version>

         <short-name>myprefix</short-name>

         <uri>myuri</uri>

         <tag>

            <name>mytag</name>

            <tag-class>package.MyTag</tag-class>

            <body-content>empty</body-content>

            <attribute>

               <name>attr1</name>

               <required>true</required>

               <rtexprvalue>true</rtexprvalue>

            </attribute>

            <attribute>

               <name>attr2</name>

               <rtexprvalue>true</rtexprvalue>

            </attribute>

         </tag>

      </taglib>

       

      And all of this is packaged like:

      myApp.war/WEB-INF/lib

           tagfile.jar (contains the tagfile (mytagfile.tag) and its TLD)

           taghandler.jar (contains the tag (myprefix:mytag), and its TLD which is used by mytagfile.tag)

               

      At this moment, it can be noticed that attr2 is an attribute which accepts EL (rtexprvalue = true).

       

      That said, when the translation phase occurs there is no error, but when the generated java file is compiled, it throws a NumberFormatException.

      Caused by: java.lang.NumberFormatException: For input string: "${value}"

        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

        at java.lang.Integer.parseInt(Integer.java:569)

        at java.lang.Integer.valueOf(Integer.java:766)

        at org.apache.jasper.compiler.JspUtil.coerceToInteger(JspUtil.java:585)

       

      When translated, the EL expression as passed as argument to a method as a plain string, and the getter method in this Tag Handler (myprefix:mytag) expects an Integer.

       

      As I said before, this is an legacy application and this tag (myprefix:mytag) is used all over the place without an unexpected behavior like the one I have just described.

      I also tried to reproduced this scenario, using another tag into my tagfile and the same bahavior happens.

       

      The only clue I have until now, is that it is being used by a tagfile which is placed inside an jar file. Is this a problem?

      At this time I can't figure out if it is an wildfly bug, or If I am somehow violating the specification. Of course it is much more likely to be a mistake of mine.

       

      I would appreciate any help.