Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8027908

serialVersionUID of javax.xml.bind.TypeConstraintException accidently changed

    XMLWordPrintable

Details

    • b124
    • Verified

    Backports

      Description

        The JCK tests for the serialization of the j.x.b.TypeConstraintException starts to fail for jdk8b112:
        api/javax_xml/bind/TypeConstraintException/serial/index.html#Input: Failed. test cases: 3; all failed; first test case failure: serial2008

        http://moonblade.ru.oracle.com/set/java/jck/qa-results/jck/8/ea/b34/results/qac/1136_failed/jtReport/failed.html

        Serialized byte output of the j.x.b.TypeConstraintException instance is in the attached file TCE.ser.
        TCE.ser was created with jdk8b111.

        Minimized test should be run with jdk8b112 and later:
        --------------------------------------------------------------------------------------
        public class SerTest {

            public static void main(String[] args) throws IOException, ClassNotFoundException {
        // ser("D:\\TCE.ser", new TypeConstraintException("msg"));
                deser("D:\\TCE.ser");
            }

            private static void ser(String fName, Serializable lambda) throws IOException {
                try (ObjectOutputStream ostream = new ObjectOutputStream(new FileOutputStream(fName))) {
                    ostream.writeObject(lambda);
                }
            }

            private static Object deser(String fName) throws IOException, ClassNotFoundException {
                System.out.println("Deserialized object from '" + fName + "':");
                try (ObjectInputStream istream = new ObjectInputStream(new FileInputStream(fName))) {
                    Object o = istream.readObject();
                    System.out.println(o.getClass());
                    return o;
                }
            }

        }
        --------------------------------------------------------------------------------------

        Output:
        --------------------------------------------------------------------------------------
        Exception in thread "main" java.io.InvalidClassException: javax.xml.bind.TypeConstraintException; local class incompatible: stream classdesc serialVersionUID = -3059799699420143848, local class serialVersionUID = -8953627615972140042
        at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:621)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1621)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1516)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1772)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1349)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
        at SerTest.deser(SerTest.java:26)
        at SerTest.main(SerTest.java:14)
        --------------------------------------------------------------------------------------

        Attachments

          Issue Links

            Activity

              People

                isavytsk Iaroslav Savytskyi (Inactive)
                evotchen Elena Votchennikova (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: