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

REGRESSION: JScrollBar does NOT serialize if overridden in JDK 5.0

    XMLWordPrintable

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]


      A DESCRIPTION OF THE PROBLEM :
      It appears that if you override a JScrollBar in 1.5 it throws an exception when trying to serialize.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the following code under 1.5
      public class TestSerialization {

          public static void main(String[] args) {
              try {
                  (new java.io.ObjectOutputStream(new java.io.ByteArrayOutputStream())).writeObject(new Scrollbar());
                  System.exit(0);
              }
              catch (java.io.IOException e) {
                  e.printStackTrace();
              }
          }

          private static class Scrollbar extends javax.swing.JScrollBar {
              public Scrollbar() {
              }
          }
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Process finished with exit code 0
      ACTUAL -
      ava.io.NotSerializableException: javax.swing.plaf.metal.MetalScrollBarUI
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
      at java.io.ObjectOutputStream.access$100(ObjectOutputStream.java:135)
      at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1512)
      at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:418)
      at java.awt.Container.writeObject(Container.java:3461)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
      at TestSerialization.main(TestSerialization.java:6)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      ava.io.NotSerializableException: javax.swing.plaf.metal.MetalScrollBarUI
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
      at java.io.ObjectOutputStream.access$100(ObjectOutputStream.java:135)
      at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1512)
      at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:418)
      at java.awt.Container.writeObject(Container.java:3461)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
      at TestSerialization.main(TestSerialization.java:6)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class TestSerialization {

          public static void main(String[] args) {
              try {
                  (new java.io.ObjectOutputStream(new java.io.ByteArrayOutputStream())).writeObject(new Scrollbar());
                  System.exit(0);
              }
              catch (java.io.IOException e) {
                  e.printStackTrace();
              }
          }

          private static class Scrollbar extends javax.swing.JScrollBar {
              public Scrollbar() {
              }
          }
      }

      ---------- END SOURCE ----------

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 11/1/04 23:41 GMT

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              svioletsunw Scott Violet (Inactive)
              Reporter:
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: