axis serializes unwanted attributes (e.g. lowestSetBit of java.math.BigInteger)
-------------------------------------------------------------------------------

         Key: AXIS-1885
         URL: http://issues.apache.org/jira/browse/AXIS-1885
     Project: Axis
        Type: Bug
  Components: Serialization/Deserialization  
    Versions: 1.2RC3    
 Environment: every environment
    Reporter: Daniel David Schäfer


Hi all,

I have found a compatibility-problems between Axis 1.1 and 1.2RC3.
When you use xsd:integer in your wsdl, axis maps it to java.math.BigInteger.
java.math.BigInteger provides a method getLowestSetBit() that leads axis to the
erroneous attempt to write an attribute "lowestSetBit" to the xml it serializes.
I have provided a little patch that prevents axis from serializing any 
attributes it finds 
in objects of classes that extend java.lang.Number (like many wrapper-classes 
of simple types).

btw: under which circumstances can this be false:

   if (propertyDescriptor != null && !(value instanceof SimpleType))

how can e.g. java.lang.Integer be an instance of 
org.apache.axis.encoding.SimpleType?

bye

Daniel


===================================================================
RCS file: 
/usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/ser/SimpleSerializer.java,v
retrieving revision 1.1
retrieving revision 1.3
diff -u -r1.1 -r1.3
--- dev_projects/axis12/src/org/apache/axis/encoding/ser/SimpleSerializer.java  
2005/03/15 09:34:22     1.1
+++ dev_projects/axis12/src/org/apache/axis/encoding/ser/SimpleSerializer.java  
2005/03/17 12:26:48     1.3
@@ -128,6 +128,10 @@
             return context.qName2String((QName)value);
         }
 
+               if(value instanceof java.lang.Number) {
+                       return value.toString();
+               }
+               
         if (propertyDescriptor != null && !(value instanceof SimpleType)) {
             BeanPropertyDescriptor pd = 
BeanUtils.getSpecificPD(propertyDescriptor, "_value");
             if(pd != null) {
@@ -143,6 +147,11 @@
     private Attributes getObjectAttributes(Object value,
                                            Attributes attributes,
                                            SerializationContext context) {
+                                                                               
           
+           if(value instanceof java.lang.Number) {
+                       return attributes;
+               }
+               
         if (typeDesc != null && !typeDesc.hasAttributes())
             return attributes;
 



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to