Issue Details (XML | Word | Printable)

Key: XSTR-92
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Andreas Rummler
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
XStream

No treatment of specialized serialization

Created: 24/Jun/04 03:48 AM   Updated: 06/Mar/05 12:57 PM
Component/s: Core
Affects Version/s: 1.0.1
Fix Version/s: 1.1


 Description  « Hide
Java classes may define a specialized serialization (see JavaDoc for
Serializable) by defining two methods:

private void writeObject(ObjectOutputStream out) throws IOException
private void readObject(ObjectInputStream in) throws IOException

XStream is not capable of handling these cases.

A simple usecase:

public class SpecialClass {
protected transient String[] array = ...
private void writeObject( ObjectOutputStream out ) { // do something special with "array" here (i.e. encrpyt it) // and write to "out" }
}

XStream does not look at "array" because it's transient, but does also not treat writeObject(), so a serialized object of SpecialClass will be empty.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Gili added a comment - 07/Dec/04 02:36 AM
Hi Andreas,

The website changelog reads:

  • Partial support for objects that specify their own serialization schemes by implementing readObject() and writeObject() (as in Java serialization spec). Note, this currently does not support the putFields()/readFields() method (use by only 8 classes in the entire JDK).

for the latest snapshot. Does the snapshot implementation solve the problem you mentioned?

Thanks,
Gili


Joe Walnes added a comment - 12/Dec/04 10:32 AM
This is still only partially implemented.

It does not currenlty support the case where more than one class in the inheritance hierarchy contain read/writeObject() methods.


Joe Walnes added a comment - 22/Dec/04 02:32 AM
Done!

The format in the latest snapshot has changed somewhat from previous snapshots, but it's now all good.