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

[macosx] NotSerializableException during JFrame with MenuBar serialization

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b01
    • OS:
      os_x

      Description

      Test to reproduce:
      =======
          public static void main(String[] args) throws Exception {
              JFrame frame = new JFrame();
              frame.setJMenuBar(new JMenuBar());
              ByteArrayOutputStream baos = new ByteArrayOutputStream(10000);
              new ObjectOutputStream(baos).writeObject(frame);
          }
      =======

      Exception:

      Exception in thread "main" java.io.NotSerializableException: com.apple.laf.AquaMenuBarBorder
      at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1185)
      at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1553)
      at java.base/java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:442)
      at java.desktop/javax.swing.JComponent.writeObject(JComponent.java:5579)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1031)
      at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1497)
      at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
      at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
      at java.base/java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379)
      at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      at java.base/java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:163)
      at java.base/java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1713)
      at java.base/java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:483)
      at java.desktop/java.awt.Container.writeObject(Container.java:3694)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1031)
      at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1497)
      at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
      at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
      at java.base/java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379)
      at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      at java.base/java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:163)
      at java.base/java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1713)
      at java.base/java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:483)
      at java.desktop/java.awt.Container.writeObject(Container.java:3694)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1031)
      at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1497)
      at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
      at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
      at java.base/java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1379)
      at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      at java.base/java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:163)
      at java.base/java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1713)
      at java.base/java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:483)
      at java.desktop/java.awt.Container.writeObject(Container.java:3694)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1031)
      at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1497)
      at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
      at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
      at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ssadetsky Semyon Sadetsky
                Reporter:
                ssadetsky Semyon Sadetsky
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: