[jboss-jira] [JBoss JIRA] Commented: (JBCACHE-756) Marshaller breaks with Strings of length greater than 32767
Manik Surtani (JIRA)
jira-events at jboss.com
Wed Aug 30 08:39:43 EDT 2006
[ http://jira.jboss.com/jira/browse/JBCACHE-756?page=comments#action_12342334 ]
Manik Surtani commented on JBCACHE-756:
---------------------------------------
The Marshaller writes Strings to the stream using ObjectOutputStream.writeUTF() - which has this limitation:
http://java.sun.com/j2se/1.5.0/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String)
According to the docs, this limits string lengths to 65535 bytes.
If you were to use multi-byte Strings (euro accents, etc) 32767 characters x 2 bytes per char = 65534 bytes. 32768 characters (at 2 bytes per char) will cross this limit and you will see an overflow.
The fix to this problem would be NOT to use writeUTF() but to serialize the Strings themselves onto the stream, but this is less efficient. Any other mechanism of converting the String to a char array or a byte array will result in some sort of limitation as a byte count will have to be included in the stream.
> Marshaller breaks with Strings of length greater than 32767
> -----------------------------------------------------------
>
> Key: JBCACHE-756
> URL: http://jira.jboss.com/jira/browse/JBCACHE-756
> Project: JBoss Cache
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Replication
> Affects Versions: 1.4.0, 1.4.0.SP1
> Reporter: Manik Surtani
> Assigned To: Manik Surtani
> Fix For: 2.0.0, 1.4.0.SP2
>
>
> See unit tests added.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list