You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/04/07 17:17:33 UTC

DO NOT REPLY [Bug 44766] New: Tomcat's EL implementation doesn' t coerce custom Number subclasses

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: tomcat-dev@jakarta.apache.org
        ReportedBy: kaszynski@gmail.com


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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 44766] Tomcat's EL implementation doesn't coerce custom Number subclasses

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44766

--- Comment #4 from Jackie Rosen <ja...@hushmail.com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44766] Tomcat's EL implementation doesn' t coerce custom Number subclasses

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44766





--- Comment #1 from Mark Thomas <ma...@apache.org>  2008-04-08 14:23:38 PST ---
I've committed a fix to trunk. The original code is a mystery to me too at the
minute.

I'll propose this for 6.0.x once people on the list have had a couple of days
to mull it over.


-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44766] Tomcat's EL implementation doesn' t coerce custom Number subclasses

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44766


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #3 from Mark Thomas <ma...@apache.org>  2008-04-17 10:37:36 PST ---
The patch has been applied to 6.0.x and will be in 6.0.17 onwards.


-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44766] Tomcat's EL implementation doesn' t coerce custom Number subclasses

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44766





--- Comment #2 from Konstantin Kolinko <kn...@gmail.com>  2008-04-08 18:39:52 PST ---
Created an attachment (id=21797)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21797)
Code cleanup for org.apache.el.* - removes attempts to compare Object classes
against primitive types.

Code cleanup for several classes in org.apache.el.**

In those classes there are places where java.lang.Class instances are compared
against classes of primitive types (such as Long.TYPE, Integer.TYPE, etc.)

In the case when those java.lang.Class instances are a result of
object.getClass() call (that is, obtained from an Object), they cannot be equal
to a primitive type.  In such case these comparisons are no-op, producing the
value of false.

This patch removes these no-op comparisons from the code.


-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org