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 sc...@apache.org on 2002/07/11 19:54:56 UTC
cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser ArraySerializer.java
scheu 2002/07/11 10:54:55
Modified: java/src/org/apache/axis/encoding/ser ArraySerializer.java
Log:
Problem:
If the ArraySerializer is given a value that is a Calendar[] that contains elements of
GregorianCalendar, the array is serializered correctly.
However, if the ArraySerializer is given a GregorianCalendar[], the ArraySerializer
throws an exception indicating that it cannot find a Serializer.
Solution:
The code in ArraySerializer is changed to look for at the super classes to find
the componentQName for situations like the second case above.
NOTE: This problem was found while running the JAXRPC TCK.
Revision Changes Path
1.25 +17 -2 xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java
Index: ArraySerializer.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ArraySerializer.java 3 Jul 2002 17:50:22 -0000 1.24
+++ ArraySerializer.java 11 Jul 2002 17:54:55 -0000 1.25
@@ -116,6 +116,7 @@
list = (Collection)value;
}
+ // Get the componentType of the array/list
Class componentType;
if (list == null) {
componentType = cls.getComponentType();
@@ -136,11 +137,25 @@
dims += "[]";
}
-
+ // Get the QName of the componentType.
+ // If not found, look at the super classes
componentQName = context.getQNameForClass(componentType);
- if (componentQName == null)
+ if (componentQName == null) {
+ Class searchCls = componentType;
+ while(searchCls != null && componentQName == null) {
+ searchCls = searchCls.getSuperclass();
+ componentQName = context.getQNameForClass(searchCls);
+ }
+ if (componentQName != null) {
+ componentType = searchCls;
+ }
+ }
+
+ if (componentQName == null) {
throw new IOException(
JavaUtils.getMessage("noType00", componentType.getName()));
+ }
+
String prefix = context.getPrefixForURI(componentQName.getNamespaceURI());
String compType = prefix + ":" + componentQName.getLocalPart();
int len = (list == null) ? Array.getLength(value) : list.size();