Bug 45953 - ELSupport.coerceToNumber with Number as type
Summary: ELSupport.coerceToNumber with Number as type
Status: RESOLVED DUPLICATE of bug 43656
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.18
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
: 47944 (view as bug list)
Depends on:
Reported: 2008-10-06 04:47 UTC by Bekir Öztaskin
Modified: 2009-10-08 04:54 UTC (History)
1 user (show)


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