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 "Daniel David Schäfer (JIRA)" <ax...@ws.apache.org> on 2005/03/17 15:13:22 UTC
[jira] Created: (AXIS-1886) Axis serializes xsd:int as multiRef
Axis serializes xsd:int as multiRef
-----------------------------------
Key: AXIS-1886
URL: http://issues.apache.org/jira/browse/AXIS-1886
Project: Axis
Type: Bug
Components: Serialization/Deserialization
Versions: 1.2RC3
Environment: every environment
Reporter: Daniel David Schäfer
Hi all,
I found a strange behaviour of axis when it serializes nillable bean-members declared as xsd:int.
I think, it is absolutely overkill to encode a single integer to a chunk like this:
<multiRef
id="id5"
soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="xsd:int"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1111054002</multiRef>
I found a routine called isPrimitive() that decides if a given object should be serialized as an
object-reference (multiRef at the end of the soap-body) or directly into the data-structure where
it is located. This routine calls obj.getClass().isPrimitive() which is unfortunately never true
with any java-object but only with class-objects like Integer.TYPE (which is the type of int and not
of java.lang.Integer).
So I provided a little patch that returns true for isPrimitive if the given object is of a subtype
of java.lang.Number (like Integer, Float, etc.).
bye
Daniel
===================================================================
RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1
+++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:03:05 1.2
@@ -606,9 +606,13 @@
public boolean isPrimitive(Object value)
{
if (value == null) return true;
-
+
+ if(value instanceof java.lang.Number) {
+ return true;
+ }
+
Class javaType = value.getClass();
-
+
if (javaType.isPrimitive()) return true;
if (javaType == String.class) return true;
--
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
[jira] Commented: (AXIS-1886) Axis serializes xsd:int as multiRef
Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/AXIS-1886?page=comments#action_61125 ]
Davanum Srinivas commented on AXIS-1886:
----------------------------------------
it got buried in the wrong bug :)
> Axis serializes xsd:int as multiRef
> -----------------------------------
>
> Key: AXIS-1886
> URL: http://issues.apache.org/jira/browse/AXIS-1886
> Project: Axis
> Type: Bug
> Components: Serialization/Deserialization
> Versions: 1.2RC3
> Environment: every environment
> Reporter: Daniel David Schäfer
>
> Hi all,
> I found a strange behaviour of axis when it serializes nillable bean-members declared as xsd:int.
> I think, it is absolutely overkill to encode a single integer to a chunk like this:
> <multiRef
> id="id5"
> soapenc:root="0"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="xsd:int"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1111054002</multiRef>
> I found a routine called isPrimitive() that decides if a given object should be serialized as an
> object-reference (multiRef at the end of the soap-body) or directly into the data-structure where
> it is located. This routine calls obj.getClass().isPrimitive() which is unfortunately never true
> with any java-object but only with class-objects like Integer.TYPE (which is the type of int and not
> of java.lang.Integer).
> So I provided a little patch that returns true for isPrimitive if the given object is of a subtype
> of java.lang.Number (like Integer, Float, etc.).
> bye
> Daniel
> ===================================================================
> RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1
> +++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:03:05 1.2
> @@ -606,9 +606,13 @@
> public boolean isPrimitive(Object value)
> {
> if (value == null) return true;
> -
> +
> + if(value instanceof java.lang.Number) {
> + return true;
> + }
> +
> Class javaType = value.getClass();
> -
> +
> if (javaType.isPrimitive()) return true;
>
> if (javaType == String.class) return true;
--
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
[jira] Commented: (AXIS-1886) Axis serializes xsd:int as multiRef
Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/AXIS-1886?page=comments#action_61121 ]
Davanum Srinivas commented on AXIS-1886:
----------------------------------------
Daniel,
Can you please review the code here:
http://marc.theaimsgroup.com/?l=axis-dev&m=110612551031080&w=2
http://issues.apache.org/jira/browse/AXIS-1771
specifically the isPrimitiveWrapper usage? Can you please submit a new patch that uses that mechanism (to cover more cases)
thanks,
dims
> Axis serializes xsd:int as multiRef
> -----------------------------------
>
> Key: AXIS-1886
> URL: http://issues.apache.org/jira/browse/AXIS-1886
> Project: Axis
> Type: Bug
> Components: Serialization/Deserialization
> Versions: 1.2RC3
> Environment: every environment
> Reporter: Daniel David Schäfer
>
> Hi all,
> I found a strange behaviour of axis when it serializes nillable bean-members declared as xsd:int.
> I think, it is absolutely overkill to encode a single integer to a chunk like this:
> <multiRef
> id="id5"
> soapenc:root="0"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="xsd:int"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1111054002</multiRef>
> I found a routine called isPrimitive() that decides if a given object should be serialized as an
> object-reference (multiRef at the end of the soap-body) or directly into the data-structure where
> it is located. This routine calls obj.getClass().isPrimitive() which is unfortunately never true
> with any java-object but only with class-objects like Integer.TYPE (which is the type of int and not
> of java.lang.Integer).
> So I provided a little patch that returns true for isPrimitive if the given object is of a subtype
> of java.lang.Number (like Integer, Float, etc.).
> bye
> Daniel
> ===================================================================
> RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1
> +++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:03:05 1.2
> @@ -606,9 +606,13 @@
> public boolean isPrimitive(Object value)
> {
> if (value == null) return true;
> -
> +
> + if(value instanceof java.lang.Number) {
> + return true;
> + }
> +
> Class javaType = value.getClass();
> -
> +
> if (javaType.isPrimitive()) return true;
>
> if (javaType == String.class) return true;
--
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
[jira] Commented: (AXIS-1886) Axis serializes xsd:int as multiRef
Posted by "Daniel David Schäfer (JIRA)" <ax...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/AXIS-1886?page=comments#action_61190 ]
Daniel David Schäfer commented on AXIS-1886:
--------------------------------------------
Hi,
this version should work:
===================================================================
RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v
retrieving revision 1.1
retrieving revision 1.3
diff -u -r1.1 -r1.3
--- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1
+++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/18 08:15:02 1.3
@@ -595,6 +595,22 @@
return getTypeMapping().getTypeQName(cls);
}
+ /**
+ * Checks if the javaType is a primitive-wrapper
+ */
+ private static boolean isPrimitiveWrapper(Class javaType)
+ {
+ if (javaType == Integer.class) return true;
+ if (javaType == Long.class) return true;
+ if (javaType == Double.class) return true;
+ if (javaType == Float.class) return true;
+ if (javaType == Boolean.class) return true;
+ if (javaType == Short.class) return true;
+ if (javaType == Character.class) return true;
+ if (javaType == Byte.class) return true;
+ return false;
+ }
+
/**
* Indicates whether the object should be interpretted as a primitive
* for the purposes of multi-ref processing. A primitive value
@@ -606,11 +622,10 @@
public boolean isPrimitive(Object value)
{
if (value == null) return true;
-
+
Class javaType = value.getClass();
- if (javaType.isPrimitive()) return true;
-
+ if (SerializationContext.isPrimitiveWrapper(javaType)) return true;
if (javaType == String.class) return true;
if (Calendar.class.isAssignableFrom(javaType)) return true;
if (Date.class.isAssignableFrom(javaType)) return true;
> Axis serializes xsd:int as multiRef
> -----------------------------------
>
> Key: AXIS-1886
> URL: http://issues.apache.org/jira/browse/AXIS-1886
> Project: Axis
> Type: Bug
> Components: Serialization/Deserialization
> Versions: 1.2RC3
> Environment: every environment
> Reporter: Daniel David Schäfer
>
> Hi all,
> I found a strange behaviour of axis when it serializes nillable bean-members declared as xsd:int.
> I think, it is absolutely overkill to encode a single integer to a chunk like this:
> <multiRef
> id="id5"
> soapenc:root="0"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="xsd:int"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1111054002</multiRef>
> I found a routine called isPrimitive() that decides if a given object should be serialized as an
> object-reference (multiRef at the end of the soap-body) or directly into the data-structure where
> it is located. This routine calls obj.getClass().isPrimitive() which is unfortunately never true
> with any java-object but only with class-objects like Integer.TYPE (which is the type of int and not
> of java.lang.Integer).
> So I provided a little patch that returns true for isPrimitive if the given object is of a subtype
> of java.lang.Number (like Integer, Float, etc.).
> bye
> Daniel
> ===================================================================
> RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1
> +++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:03:05 1.2
> @@ -606,9 +606,13 @@
> public boolean isPrimitive(Object value)
> {
> if (value == null) return true;
> -
> +
> + if(value instanceof java.lang.Number) {
> + return true;
> + }
> +
> Class javaType = value.getClass();
> -
> +
> if (javaType.isPrimitive()) return true;
>
> if (javaType == String.class) return true;
--
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
[jira] Commented: (AXIS-1886) Axis serializes xsd:int as multiRef
Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/AXIS-1886?page=comments#action_61124 ]
Davanum Srinivas commented on AXIS-1886:
----------------------------------------
Can you confirm that that fixes your problem? and can u please submit a patch ("diff -u") against latest CVS?
thanks,
dims
> Axis serializes xsd:int as multiRef
> -----------------------------------
>
> Key: AXIS-1886
> URL: http://issues.apache.org/jira/browse/AXIS-1886
> Project: Axis
> Type: Bug
> Components: Serialization/Deserialization
> Versions: 1.2RC3
> Environment: every environment
> Reporter: Daniel David Schäfer
>
> Hi all,
> I found a strange behaviour of axis when it serializes nillable bean-members declared as xsd:int.
> I think, it is absolutely overkill to encode a single integer to a chunk like this:
> <multiRef
> id="id5"
> soapenc:root="0"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="xsd:int"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1111054002</multiRef>
> I found a routine called isPrimitive() that decides if a given object should be serialized as an
> object-reference (multiRef at the end of the soap-body) or directly into the data-structure where
> it is located. This routine calls obj.getClass().isPrimitive() which is unfortunately never true
> with any java-object but only with class-objects like Integer.TYPE (which is the type of int and not
> of java.lang.Integer).
> So I provided a little patch that returns true for isPrimitive if the given object is of a subtype
> of java.lang.Number (like Integer, Float, etc.).
> bye
> Daniel
> ===================================================================
> RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1
> +++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:03:05 1.2
> @@ -606,9 +606,13 @@
> public boolean isPrimitive(Object value)
> {
> if (value == null) return true;
> -
> +
> + if(value instanceof java.lang.Number) {
> + return true;
> + }
> +
> Class javaType = value.getClass();
> -
> +
> if (javaType.isPrimitive()) return true;
>
> if (javaType == String.class) return true;
--
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
[jira] Commented: (AXIS-1886) Axis serializes xsd:int as multiRef
Posted by "Anthony Foiani (JIRA)" <ax...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/AXIS-1886?page=comments#action_12330639 ]
Anthony Foiani commented on AXIS-1886:
--------------------------------------
There's at least one more dup of this issue, AXIS-2077; someone might want to link that in and/or mark it as a duplicate.
Also, has this been checked into CVS? Can we expect it in the next release (whether that be 1.2.2 or 1.3)? Thanks!
> Axis serializes xsd:int as multiRef
> -----------------------------------
>
> Key: AXIS-1886
> URL: http://issues.apache.org/jira/browse/AXIS-1886
> Project: Apache Axis
> Type: Bug
> Components: Serialization/Deserialization
> Versions: 1.2RC3
> Environment: every environment
> Reporter: Daniel David Schäfer
>
> Hi all,
> I found a strange behaviour of axis when it serializes nillable bean-members declared as xsd:int.
> I think, it is absolutely overkill to encode a single integer to a chunk like this:
> <multiRef
> id="id5"
> soapenc:root="0"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="xsd:int"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1111054002</multiRef>
> I found a routine called isPrimitive() that decides if a given object should be serialized as an
> object-reference (multiRef at the end of the soap-body) or directly into the data-structure where
> it is located. This routine calls obj.getClass().isPrimitive() which is unfortunately never true
> with any java-object but only with class-objects like Integer.TYPE (which is the type of int and not
> of java.lang.Integer).
> So I provided a little patch that returns true for isPrimitive if the given object is of a subtype
> of java.lang.Number (like Integer, Float, etc.).
> bye
> Daniel
> ===================================================================
> RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1
> +++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:03:05 1.2
> @@ -606,9 +606,13 @@
> public boolean isPrimitive(Object value)
> {
> if (value == null) return true;
> -
> +
> + if(value instanceof java.lang.Number) {
> + return true;
> + }
> +
> Class javaType = value.getClass();
> -
> +
> if (javaType.isPrimitive()) return true;
>
> if (javaType == String.class) return true;
--
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
[jira] Commented: (AXIS-1886) Axis serializes xsd:int as multiRef
Posted by "Daniel David Schäfer (JIRA)" <ax...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/AXIS-1886?page=comments#action_61123 ]
Daniel David Schäfer commented on AXIS-1886:
--------------------------------------------
Hi,
I think, what the authors of these articles wrote is exactly the solution of this problem. I wonder, why this is known since january but there is no change in the cvs.
At least I was not able to find the String "isPrimitiveWrapper" in the axis-code anywhere.
bye
Daniel
> Axis serializes xsd:int as multiRef
> -----------------------------------
>
> Key: AXIS-1886
> URL: http://issues.apache.org/jira/browse/AXIS-1886
> Project: Axis
> Type: Bug
> Components: Serialization/Deserialization
> Versions: 1.2RC3
> Environment: every environment
> Reporter: Daniel David Schäfer
>
> Hi all,
> I found a strange behaviour of axis when it serializes nillable bean-members declared as xsd:int.
> I think, it is absolutely overkill to encode a single integer to a chunk like this:
> <multiRef
> id="id5"
> soapenc:root="0"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xsi:type="xsd:int"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1111054002</multiRef>
> I found a routine called isPrimitive() that decides if a given object should be serialized as an
> object-reference (multiRef at the end of the soap-body) or directly into the data-structure where
> it is located. This routine calls obj.getClass().isPrimitive() which is unfortunately never true
> with any java-object but only with class-objects like Integer.TYPE (which is the type of int and not
> of java.lang.Integer).
> So I provided a little patch that returns true for isPrimitive if the given object is of a subtype
> of java.lang.Number (like Integer, Float, etc.).
> bye
> Daniel
> ===================================================================
> RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1
> +++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:03:05 1.2
> @@ -606,9 +606,13 @@
> public boolean isPrimitive(Object value)
> {
> if (value == null) return true;
> -
> +
> + if(value instanceof java.lang.Number) {
> + return true;
> + }
> +
> Class javaType = value.getClass();
> -
> +
> if (javaType.isPrimitive()) return true;
>
> if (javaType == String.class) return true;
--
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