XStream
  1. XStream
  2. XSTR-92

No treatment of specialized serialization

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.1
    • Component/s: Core
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        Gili added a comment -

        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

        Show
        Gili added a comment - 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
        Hide
        Joe Walnes added a comment -

        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.

        Show
        Joe Walnes added a comment - 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.
        Hide
        Joe Walnes added a comment -

        Done!

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

        Show
        Joe Walnes added a comment - Done! The format in the latest snapshot has changed somewhat from previous snapshots, but it's now all good.

          People

          • Assignee:
            Unassigned
            Reporter:
            Andreas Rummler
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: