Bug 37080 - Incorrect type coersion from char
Summary: Incorrect type coersion from char
Status: RESOLVED INVALID
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.1.0
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-13 18:52 UTC by Ibexx
Modified: 2005-10-15 21:22 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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
${tChar}

Crashes
<c:if test="${tChar == 't'}">
  inside	
</c:if>
<!-- 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.