scheu 02/02/08 15:14:44
Modified: java/src/org/apache/axis/encoding/ser ArrayDeserializer.java
Log:
Made changes to hopefully fix David Cole's problem reported on axis-dev.
In his case, a deserialized HashMap contained values of ArrayList instead
of the expected User[]. Changed the array deserializer to
convert itself into the expected array type after the elements have
been set but before referent objects are set.
Need a testcase...
Revision Changes Path
1.4 +13 -2
xml-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializer.java
Index: ArrayDeserializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArrayDeserializer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ArrayDeserializer.java 8 Feb 2002 23:03:36 -0000 1.3
+++ ArrayDeserializer.java 8 Feb 2002 23:14:44 -0000 1.4
@@ -221,8 +221,10 @@
try {
ClassLoader cl =
context.getMessageContext().getClassLoader();
- arrayClass = Class.forName(JavaUtils.getLoadableClassName(
- arrayItemClass.getName() + "[]"), true, cl);
+ arrayClass = Class.forName(
+ JavaUtils.getLoadableClassName(
+ JavaUtils.getTextClassName(arrayItemClass.getName()) +
"[]"),
+ true, cl);
} catch (Exception e) {
throw new SAXException(
JavaUtils.getMessage("noComponent00", "" +
defaultItemType));
@@ -463,8 +465,17 @@
}
}
// If all indices are accounted for, the array is complete.
+ // Try converting the value (probably an ArrayListExtension)
+ // into the expected array.
+ // valueComplete is invoked to inform all referents that the
+ // value of the array is ready.
waiting.remove(hint);
if (isEnded && waiting.size()==0) {
+ try {
+ if (arrayClass != null) {
+ value = JavaUtils.convert(value, arrayClass);
+ }
+ } catch (Exception e) {}
valueComplete();
}
}