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

NotSerializableException is thrown when serializing AWT components

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • client-libs
    • b53
    • generic
    • generic

      After the fix about removing all the finalizers from AWT code, all the AWT components have become unserializable. Execute the following simple test:

      ----

      import java.awt.*;

      import java.io.*;

      public class SerializeBroken
      {
        public static void main(String[] args)
        {
          Frame f = new Frame();
          f.setBounds(100, 100, 100, 100);
          f.setVisible(true);

          try
          {
            ObjectOutputStream out = new ObjectOutputStream(new ByteArrayOutputStream());
            out.writeObject(f);
          }
          catch (Exception z)
          {
            z.printStackTrace(System.err);
          }
        }
      }

      ----

      If the frame is successfully serialized, the bug is not reproduced.

            art Artem Ananiev (Inactive)
            art Artem Ananiev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: