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/04/25 20:28:03 UTC

DO NOT REPLY [Bug 19330] New: - Empty String deserialization + fix

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=19330>.
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=19330

Empty String deserialization + fix

           Summary: Empty String deserialization + fix
           Product: Axis
           Version: 1.0-rc2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: dhauver@vecna.com


org.apache.axis.encoding.ser.SimpleDeserializer throws a
StringIndexOutOfBoundsException in the onEndElement(String namespace, String
localName, DeserializationContext context) method (line 226).  This occurs when
an empty String is being deserialized.  This can be fixed by changing the
following code snippet:

//if (isNil || val == null) {  -- FIX
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11945
if (isNil) {
    value = null;
    return;
}

to:

if (isNil || (val.size() == 0 && javaType != java.lang.String.class)) {
    value = null;
    return;
}

Looking through the cvs log on this file, I noted that essentially the same fix
was made in revision 1.26, but it was removed in revision 1.28 because it caused
empty Strings to be deserialized to null. Checking the javaType against
String.class fixes this case.