tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Kolinko" <knst.koli...@gmail.com>
Subject Re: svn commit: r646076 - /tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java
Date Tue, 08 Apr 2008 22:00:29 GMT
Well, obviously the new code is not equivalent to the old one, because
Long.TYPE and other TYPE constants are the classes for the primitive
types (long, int etc.), and those are not an instance of
java.lang.Number.

>From the sources:
o.a.el.lang.ELArithmetic.isNumberType()
  is used in
  o.a.el.lang.ELSupport.checkType()
    and that is used in
    o.a.jasper.compiler.Validator.checkXmlAttributes()

Looking into Validator.checkXmlAttributes(), there is
"expectedClass = JspUtil.toClass(expectedType, loader);"

and the value returned by JspUtil.toClass() may be "long.class" or
other primitive class.

It is from reading the sources. Have not run it though.



2008/4/9  <markt@apache.org>:
>  Modified: tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java
>  URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java?rev=646076&r1=646075&r2=646076&view=diff
>  ==============================================================================
>  --- tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java (original)
>  +++ tomcat/trunk/java/org/apache/el/lang/ELArithmetic.java Tue Apr  8 14:25:04 2008
>  @@ -326,8 +326,8 @@
>          return (obj != null && isNumberType(obj.getClass()));
>      }
>
>  -    public final static boolean isNumberType(final Class type) {
>  -        return type == (java.lang.Long.class) || type == Long.TYPE || type ==  ...
>  +    public final static boolean isNumberType(final Class<?> type) {
>  +        return (Number.class.isAssignableFrom(type));
>      }
>

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


Mime
View raw message