[ 
https://issues.apache.org/jira/browse/DIRSERVER-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913935#action_12913935
 ] 

Emmanuel Lecharny commented on DIRSERVER-1319:
----------------------------------------------

So the best would be to re-write the code, trying not to 'remember' about the 
snippet posted by Denis Denis, if possible. The logic is pretty clear : 
WriteUTF8 cannt write String larger than 64Kb because a 2 bytes long is written 
in front of the String, limitating the String length.

I would do that :
if ( string.length > 2^16 ) do
  for ( int i = 0; i < string.length; i+= 2^16)
    writeInt( 2^16 ) // deal with the case where i is not a multiple of 2^16 
here
    writeUTF(string.substring(i, 2^16))  

I'm not sure we cannot use something else than Substring (for instance, dumping 
char oe by one, using String.toCharArray() method)

> Cannot save String values larger than 64 Kb 
> --------------------------------------------
>
>                 Key: DIRSERVER-1319
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1319
>             Project: Directory ApacheDS
>          Issue Type: Bug
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>             Fix For: 2.0.0-RC1
>
>
> We can't save String values into the server due to the way the entries are 
> serialized : we are using a OutputStream.writeUTF() which is limited to 65535 
> chars.
> We have two options :
> - we save data splitting them in smaller chuncks
> - we save a reference to a file, considering the data as a stream.
> The second option would be way better, but is more complicated to implement. 
> In any case, both system change the way the serialization works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to