You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Thilo Frotscher (JIRA)" <ax...@ws.apache.org> on 2005/04/26 11:06:24 UTC

[jira] Updated: (AXIS-1910) CLONE -axis serializes unwanted attributes (e.g. lowestSetBit of java.math.BigInteger)

     [ http://issues.apache.org/jira/browse/AXIS-1910?page=all ]

Thilo Frotscher updated AXIS-1910:
----------------------------------

    Attachment: bugDemo.zip

Hi,

here is a ZIP file with demo code reproducing the bug,
Please check README file for more information.

Thanks.
Thilo

> CLONE -axis serializes unwanted attributes (e.g. lowestSetBit of java.math.BigInteger)
> --------------------------------------------------------------------------------------
>
>          Key: AXIS-1910
>          URL: http://issues.apache.org/jira/browse/AXIS-1910
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2RC3
>  Environment: every environment
>     Reporter: Thilo Frotscher
>  Attachments: bugDemo.zip
>
> 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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira