Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-1885

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2RC3
    • None
    • None
    • every environment

    Description

      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;

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ddschaefer Daniel David Schäfer
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: