https://issues.apache.org/bugzilla/show_bug.cgi?id=44766
Summary: Tomcat's EL implementation doesn't coerce custom Number
subclasses
Product: Tomcat 6
Version: 6.0.14
Platform: All
URL: http://jira.jboss.com/jira/browse/RF-1715
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: Jasper
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
I have class that extends java.lang.Number, and want to use something like #{x
+ 1} where x is instance of my class.
But get IllegalArgumentException.
java.util.MissingResourceException: Can't find resource for bundle
java.util.PropertyResourceBundle, key el.convert
at java.util.ResourceBundle.getObject(ResourceBundle.java:325)
at java.util.ResourceBundle.getString(ResourceBundle.java:285)
at org.apache.el.util.MessageFactory.getArray(MessageFactory.java:67)
at org.apache.el.util.MessageFactory.get(MessageFactory.java:47)
at org.apache.el.lang.ELArithmetic.coerce(ELArithmetic.java:367)
at org.apache.el.lang.ELArithmetic.add(ELArithmetic.java:237)
at org.apache.el.parser.AstPlus.getValue(AstPlus.java:24)
at
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at
com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
That is caused by org.apache.el.lang.ELArithmetic.coerce(Number) method that
uses very strange Number type check
public final static boolean isNumberType(final Class type) {
return type == (java.lang.Long.class) || type == Long.TYPE || type ==
(java.lang.Double.class) || type == Double.TYPE || type ==
(java.lang.Byte.class) || type == Byte.TYPE || type == (java.lang.Short.class)
|| type == Short.TYPE || type == (java.lang.Integer.class) || type ==
Integer.TYPE || type == (java.lang.Float.class) || type == Float.TYPE || type
== (java.math.BigInteger.class) || type == (java.math.BigDecimal.class);
}
I think this method could make use of instanceof operator so that users could
provide their own Number subclasses.
Referenced classes reside within jasper-el.jar, so I choose Jasper component.
The bug is inspired by http://jira.jboss.com/jira/browse/RF-1715
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]