| Java Serialization to XML |
|
|
Accuracy
To demonstrate the accuracy of JSX, we compared it with Java's built-in serialization (JOS), for over 700 standard classes from Java 1.4. JSX gave exactly the same results:
Test details
- To roundtrip an object, we serialize it, then deserialize, to create a new object (a copy of the original). - The comparison of objects is made in a separate phase. It must be a deep comparison for accuracy, meaning that it includes objects that are refered to. We did this by serializing both copies (from JSX and JOS) with JOS, and then directly comparing the results.
- JOS is Java Object Serialization, and is part of the Java language (eg.
the Java keyword
- The comparison with JOS is naturally restricted to objects that JOS can handle (including objects referred to), so we had to use classes that implement Serializable. There are 2,297 Serializable classes in Java 1.4. This limitation does not apply to JSX itself - it is only for the JOS comparison - To automate the test, we used classes with a no-argument constructor, and so we test the object state that is created by the no-argument constructor. It is impossible to test all possible states automatically (eg. every possible value of each int in each object). For Java 1.4, this cuts down the Serialiable objects from 2,297 to 768 objects. This limitation does not apply to JSX itself - it is only for the JOS comparison - Some classes could not be compared because they require more initialization than their no-argument constructor provides. For example, some CORBA objects require stubs and particular security access. These could not be compared in this test. These objects and explanations appear in this this list. - The deep comparison works for classes whose serialized representation is always the same for the same object. This generally works, but there are exceptions, such as Maps and Sets. For these, a change in their element ordering is not significant, but it will change their serialized representation. A practical check for this problem is to serialize the same object twice with JOS, and see if they differ. Such objects cannot not be compared in this test. These objects and explanations appear in this this list. JSX handles Maps and Sets correctly - the limitiation is only for the JOS comparison
|