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

java.awt.Frame is not correctly serialized in kestrel

XMLWordPrintable

    • kestrel
    • sparc
    • solaris_2.5.1



      Name: avC70361 Date: 06/23/99



        A java.awt.Frame instance cannot be serialized in kestrel when the instance has a java.awt.Button
      added. An unexpected exception is thrown : java.io.NotSerializableException: sun.awt.X11GraphicsConfig.

      Here is a test demonstrating the bug.
      ---------------FrameTest.java--------------
      import java.awt.Button;
      import java.awt.Frame;
      import java.io.ByteArrayOutputStream;
      import java.io.IOException;
      import java.io.ObjectOutputStream;

      public class FrameTest {

          public static void main(String args[]) {
              Frame frame = new Frame("frame");
              frame.add(new Button("button"));
              ObjectOutputStream stream = null;

              try {
                  stream = new ObjectOutputStream(new ByteArrayOutputStream());
                  stream.writeObject(frame);
                  stream.close();
                  System.out.println("OK");
              } catch (IOException e) {
                  System.out.println("Failed. Couldn't write " + frame + " : " + e);
              }
              System.exit(0);
          }
      }
      -----------The test output---------
      > java FrameTest
      Failed. Couldn't write java.awt.Frame[frame0,0,0,0x0,invalid,hidden,layout=java.awt.BorderLayout,resizable,title=frame] : java.io.NotSerializableException: sun.awt.X11GraphicsConfig

      ======================================================================

            bchristi Brent Christian
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: