https://issues.apache.org/bugzilla/show_bug.cgi?id=54338
            Bug ID: 54338
           Summary: Class cast exception in tagPlugin Set generated code
           Product: Tomcat 7
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: xs...@ebay.com
    Classification: Unclassified

Created attachment 29786
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29786&action=edit
Test case for "Set"

It uses "Class.cast" to convert an object to a given class in the code
generated by tagPlugin "Set".

It causes an exception when the value is primitive type,
Here is a sample,

Caused by: java.lang.ClassCastException: Cannot cast class java.lang.Integer to
int
        at java.lang.Class.cast(Class.java:1711)
        at
org.apache.jsp.WEB_002dINF.views.error_jsp._jspService(error_jsp.java:108)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
        ... 52 more


The correct way is to use "ELSupport.coerceToType".
Attached a patch and test case for this issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to