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 bu...@apache.org on 2003/06/19 14:50:56 UTC
DO NOT REPLY [Bug 14033] -
bean property multi-dimensional arrays don't deserialize
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14033>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14033
bean property multi-dimensional arrays don't deserialize
------- Additional Comments From sstromme@cc.hut.fi 2003-06-19 12:50 -------
This bug was blocking my progress in a project and I tracked it to line 305 in
org.apache.axis.encoding.ser.BeanDeserializer.java version 1.60 which was the
latest in public cvs.
In method:
public SOAPHandler onStartChild(String namespace,
String localName,
String prefix,
Attributes attributes,
DeserializationContext context)
throws SAXException
starting from line 294 in the original it reads:
// Register value target
if (propDesc.isWriteable()) {
// If this is an indexed property, and the deserializer we found
// was NOT the ArrayDeserializer, this is a non-SOAP array:
// <bean>
// <field>value1</field>
// <field>value2</field>
// ...
// In this case, we want to use the collectionIndex and make sure
// the deserialized value for the child element goes into the
// right place in the collection.
if (propDesc.isIndexed() && !(dSer instanceof ArrayDeserializer)) {
collectionIndex++;
dSer.registerValueTarget(new BeanPropertyTarget(value,
propDesc, collectionIndex));
} else {
// If we're here, the element maps to a single field value,
// whether that be a "basic" type or an array, so use the
// normal (non-indexed) BeanPropertyTarget form.
collectionIndex = -1;
dSer.registerValueTarget(new BeanPropertyTarget(value,
propDesc));
}
}
which I replaced with:
// Register value target
if (propDesc.isWriteable()) {
// If this is an indexed property, and the deserializer we found
// was NOT the ArrayDeserializer, this is a non-SOAP array:
// <bean>
// <field>value1</field>
// <field>value2</field>
// ...
// or if the dSer is an ArrayDeserializer it might still be
// contained in a non-SOAP array in which case propDesc.getType
// should return a class that is an array.
// In these cases, we want to use the collectionIndex and make sure
// the deserialized value for the child element goes into the
// right place in the collection.
if (propDesc.isIndexed() && (
!(dSer instanceof ArrayDeserializer) ||
propDesc.getType().isArray())) {
collectionIndex++;
dSer.registerValueTarget(new BeanPropertyTarget(value,
propDesc, collectionIndex));
} else {
// If we're here, the element maps to a single field value,
// whether that be a "basic" type or an array, so use the
// normal (non-indexed) BeanPropertyTarget form.
collectionIndex = -1;
dSer.registerValueTarget(new BeanPropertyTarget(value,
propDesc));
}
}
This works just fine for me but I don't know if it's a proper fix so somebody
with more knowledge should check it out.. There is, for example, the question of
whether there can be a case where we get an array class as propDesc.getType but
not an ArrayDeserializer. In that case my fix will treat it as an indexed
property but I really don't know what would be a proper response.
Hope this helps,
Sakke