Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 15065 invoked by uid 500); 25 Nov 2001 03:29:32 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 15056 invoked by uid 500); 25 Nov 2001 03:29:31 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 25 Nov 2001 03:13:34 -0000 Message-ID: <20011125031334.54477.qmail@icarus.apache.org> From: rubys@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/src/org/apache/axis/encoding ArraySerializer.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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,