Bug 45953

Summary: ELSupport.coerceToNumber with Number as type
Product: Tomcat 6 Reporter: Bekir Öztaskin <oeztaskin>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal CC: jmarks
Priority: P2    
Version: 6.0.18   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   

Description Bekir Öztaskin 2008-10-06 04:47:02 UTC
I have recently upgraded to 6.0.18 and i am getting this exception:

java.lang.IllegalArgumentException: Cannot convert 0 of type class java.lang.Long to class java.lang.Number
at org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:252)
at org.apache.el.lang.ELSupport.coerceToNumber(ELSupport.java:259)
at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:353)
at org.apache.el.parser.AstFunction.getValue(AstFunction.java:102)
at org.apache.el.parser.AstChoice.getValue(AstChoice.java:45)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:925)

I have got a function, which can format any Number to String.
<function-signature>java.lang.String formatNumber(int,java.lang.String,java.lang.String,java.lang.Number)</function-signature>

But it seems coerceToNumber can't handle a Number as Type.

Possible Solution:
If ELSupport.coerceToNumber is called with any Number instance as the first Parameter ('number')and Number.class as second ('type') it should return the first parameter without conversion.
Comment 1 Mark Thomas 2008-10-06 05:09:35 UTC
See comments 6 to 9 of the duplciate.

*** This bug has been marked as a duplicate of bug 43656 ***
Comment 2 Konstantin Kolinko 2009-10-08 04:54:45 UTC
*** Bug 47944 has been marked as a duplicate of this bug. ***