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/04 23:41:17 UTC

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

     [ http://issues.apache.org/jira/browse/AXIS-1910?page=comments#action_62142 ]
     
Thilo Frotscher commented on AXIS-1910:
---------------------------------------

This bug was reported to be fixed, but it is not.
It still occurs in 1.2RC3 and the most recent nightly build from 04.April.

Serializing BigInteger results in an attribute called "lowestBitSet" 
in the according element which breaks all attempts to validate the
message.
 

> 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

>
> 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