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

zero terminated java string serialize zero to XML

           Summary: zero terminated java string serialize zero to XML
           Product: Axis
           Version: 1.1beta
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


From: "Chris Schaefer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 18, 2002 08:45
Subject: xsd:String encoded with zero at the end...

I'm having a weird problem where my service returns strings which are
zero terminated ( like C ), but
actually _IN_ the XML.
 
Here's a chunk from a tcpdump session watching the traffic:

0x0490   6f70 6c65 2e63 6f6d 223e 0a20 2020 3c61        ople.com">....<a
0x04a0   7274 6973 7420 7873 693a 7479 7065 3d22        rtist.xsi:type="
0x04b0   7873 643a 7374 7269 6e67 223e 4d6f 7263        
xsd:string">Morc
0x04c0   6865 6562 6100 3c2f 6172 7469 7374 3e0a        heeba.</artist>.
0x04d0   2020 203c 616c 6275 6d20 7873 693a 7479        ...<album.xsi:ty

 
Indeed a print out of the byte array version of the string before serialization 
reveals:

 77 111 114 99 104 101 101 98 97 0
  M  o  r  c  h  e  e  b  a

A ZERO at the end.  I can easily fix this in my code, but unless someone 
claims otherwise,
I'm going to file this as a bug in the serializer.  I don't have a decent 
debugging environment
right now, otherwise I'd try to squish the bug myself.

Dennis M. Sosnoski ( wrote on axis-user, and might lead to further 
debugging help ) :

>From a quick look through the code there doesn't appear to be anywhere 
that even trys to check for valid characters - XMLUtils.xmlEncodeString() 
just handles encoding special characters, and 
SimpleSerializer.getValueAsString() just calls toString(). There should 
definitely be a check for valid characters in a String value. The best place 
to put this might be in SimpleSerializer, since the checking only needs to 
be done for String values (ints, floats, etc. cannot have illegal XML 
characters in their String representations, so there's no need to add 
overhead for checking these).

 - Dennis

Reply via email to