Bug 37080

Summary: Incorrect type coersion from char
Product: Taglibs Reporter: Ibexx <zackchandler>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Severity: major    
Priority: P2    
Version: 1.1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Ibexx 2005-10-13 18:52:11 UTC
The implementation crashes because of an incorrect type coersion from java type
char.  To reproduce make a controller and set a char attribute.

// Controller code
char tChar = 't';
request.setAttribute("tChar", tChar);

// Now in JSP enter this fragment
<!-- JSP Frag -->
Prints t

<c:if test="${tChar == 't'}">
<!-- End Frag -->

It crashes with this error:

javax.servlet.jsp.el.ELException: An exception occured trying to convert String
"t" to type "java.lang.Long"
Comment 1 Rahul Akolkar 2005-10-16 05:22:34 UTC
I'd recommend sending an email to taglibs-user if you have questions about 
type coercions in EL (EL != Java).

For equality operators, if any of the operands is a "IntegerType" (byte, char, 
short, integer, long or their boxed forms), both operands are attempted to be 
converted to java.lang.Long before comparison. Chapter 2 of the JSP 2.0 spec 
is about EL.