commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23324] New: - Wrong use of Class.isAssignableFrom in XMLIntrospectorHelper.isPrimitiveType
Date Mon, 22 Sep 2003 10:50:16 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23324>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23324

Wrong use of Class.isAssignableFrom in XMLIntrospectorHelper.isPrimitiveType

           Summary: Wrong use of Class.isAssignableFrom in
                    XMLIntrospectorHelper.isPrimitiveType
           Product: Commons
           Version: 1.0 Alpha
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Betwixt
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: lari.hotari@sagire.fi


There is a bug in XMLIntropectorHelper.isPrimitiveType method. It does not
return the correct value for example when you have a custom class which extends
java.util.Date.

Here is a patch to fix the incorrect usage of Class.isAssignableFrom in
XMLIntropectorHelper.java (isPrimitiveType method):

--- XMLIntrospectorHelper.java.orig	2003-08-21 15:58:11.000000000 +0300
+++ XMLIntrospectorHelper.java	2003-08-21 15:59:33.000000000 +0300
@@ -461,14 +461,14 @@
             return false;
         }
         return type.getName().startsWith( "java.lang." )
-            || type.isAssignableFrom( Number.class ) 
-            || type.isAssignableFrom( String.class ) 
-            || type.isAssignableFrom( Date.class ) 
-            || type.isAssignableFrom( java.sql.Date.class ) 
-            || type.isAssignableFrom( java.sql.Time.class ) 
-            || type.isAssignableFrom( java.sql.Timestamp.class ) 
-            || type.isAssignableFrom( java.math.BigDecimal.class ) 
-            || type.isAssignableFrom( java.math.BigInteger.class );
+            || Number.class.isAssignableFrom( type ) 
+            || String.class.isAssignableFrom( type ) 
+            || Date.class.isAssignableFrom( type ) 
+            || java.sql.Date.class.isAssignableFrom( type ) 
+            || java.sql.Time.class.isAssignableFrom( type ) 
+            || java.sql.Timestamp.class.isAssignableFrom( type ) 
+            || java.math.BigDecimal.class.isAssignableFrom( type ) 
+            || java.math.BigInteger.class.isAssignableFrom( type );
     }
     
     // Implementation methods

Mime
View raw message