Fixing bug #4128333: Serializing strings restricted to 64k bytes

View: New views
3 Messages — Rating Filter:   Alert me  

Fixing bug #4128333: Serializing strings restricted to 64k bytes

by cowwoc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4128333

I'd like to start a discussion on how we can possibly solve this bug in a backwards-compatible way. Here is my personal proposal but I'd love to hear your own ideas!

1) Add a new method to DataInputStream/DataOutputStream for encoding/decoding longer Strings (ideally this new encoding should have no fixed limit). I think this should be done independently of Serialization as this is needed by other clients.

2) Add a method to ObjectOutputStream to enable the new encoding format (which is not backwards compatible). The default would be to use the old encoding format but developers of new applications would be encouraged to use the new format. I recommend ObjectOutputStream.setMinimumVersion(enum). The default would be ObjectOutputStream.setMinimumVersion(JDK1_1) which indicates the format is backwards-compatible to JDK 1.1 but we would add ObjectOutputStream.setMinimumVersion(JDK1_7) for the new file format.

Please let me know what you think!
Gili

Re: Fixing bug #4128333: Serializing strings restricted to 64k bytes

by cowwoc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I see now that ObjectOutputStream.html#useProtocolVersion() already exists: http://java.sun.com/javase/6/docs/api/java/io/ObjectOutputStream.html#useProtocolVersion(int)

so the only thing we'd need to do in step 2 is add ObjectStreamConstants.PROTOCOL_VERSION_3.

Re: Fixing bug #4128333: Serializing strings restricted to 64k bytes

by Peter Jones-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If your concern is primarily about Java object serialization, note
that it has supported serializing strings with UTF-8 encoding larger
than 64KB since J2SE 1.3:

        http://bugs.sun.com/view_bug.do?bug_id=4217676

I presume that 4128333 remains open for Data{Input,Output}Stream only.

-- Peter


On Wed, Jan 02, 2008 at 07:25:02PM -0800, cowwoc wrote:

>
> Hi,
>
> Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4128333
>
> I'd like to start a discussion on how we can possibly solve this bug in a
> backwards-compatible way. Here is my personal proposal but I'd love to hear
> your own ideas!
>
> 1) Add a new method to DataInputStream/DataOutputStream for
> encoding/decoding longer Strings (ideally this new encoding should have no
> fixed limit). I think this should be done independently of Serialization as
> this is needed by other clients.
>
> 2) Add a method to ObjectOutputStream to enable the new encoding format
> (which is not backwards compatible). The default would be to use the old
> encoding format but developers of new applications would be encouraged to
> use the new format. I recommend ObjectOutputStream.setMinimumVersion(enum).
> The default would be ObjectOutputStream.setMinimumVersion(JDK1_1) which
> indicates the format is backwards-compatible to JDK 1.1 but we would add
> ObjectOutputStream.setMinimumVersion(JDK1_7) for the new file format.
>
> Please let me know what you think!
> Gili