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 ru...@apache.org on 2001/11/25 04:13:34 UTC
cvs commit: xml-axis/java/src/org/apache/axis/encoding ArraySerializer.java
rubys 01/11/24 19:13:34
Modified: java/src/org/apache/axis/encoding ArraySerializer.java
Log:
From section 5.1 of the SOAP Specification, rule #8 in the rules for
serialization states:
The "asize" construct contains a comma separated list of zero, one, or
more integers indicating the lengths of each dimension of the array. A
value of zero integers indicates that no particular quantity is
asserted but that the size may be determined by inspection of the
actual members.
The ZSI endpoint seems to send responses without lengths specified, and
other clients (e.g., WhiteMesa) accept such responses. Without this
change, the Axis client dies with a NullPointerException.
Note: with this change, Axis may be too lenient. Pass more actual elements
than you declare, and the array will be grown to fit. If you pass less
actual elements than declared, the array will continue to be padded with
nulls.
Revision Changes Path
1.25 +15 -1 xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java
Index: ArraySerializer.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ArraySerializer.java 2001/11/06 21:52:28 1.24
+++ ArraySerializer.java 2001/11/25 03:13:34 1.25
@@ -186,6 +186,12 @@
JavaUtils.getMessage("badInteger00", lengthStr));
}
}
+ else
+ {
+ // asize with no integers: size must be determined by inspection
+ // of the actual members.
+ value = new ArrayList();
+ }
String offset = attributes.getValue(Constants.URI_SOAP_ENC,
Constants.ATTR_OFFSET);
@@ -263,8 +269,16 @@
if (category.isDebugEnabled()) {
category.debug(JavaUtils.getMessage("gotValue00", "ArraySerializer", "[" + hint +
"] = " + value));
+ }
+ ArrayList list = (ArrayList)this.value;
+ int offset = ((Integer)hint).intValue();
+
+ // grow the list if necessary to accomodate the new member
+ while (list.size() <= offset) {
+ list.add(null);
}
- ((ArrayList)this.value).set(((Integer)hint).intValue(), value);
+
+ list.set(offset, value);
}
public void serialize(QName name, Attributes attributes,