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

Regression: New type for Font.fRequestedAttributes causes serialization failure

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • client-libs
    • 2d
    • beta
    • generic
    • generic

      In merlin, the type of field 'fRequestedAttributes' in java.awt.Font was changed
      from java.util.Hashtable to java.util.HashMap. Since 'fRequestedAttributes' is
      non-transient, Font is Serializable, and Font.writeObject uses default
      serialzation, the type of this field cannot change. Otherwise, kestrel cannot
      read Fonts serialized by merlin, and merlin cannot read Fonts serialized by
      kestrel.

      To reproduce this bug, run the test test/java/awt/CONFORMANCE under kestrel.
      From the test menu, select "Persistent serialization" and then "Save serialized
      state...". Choose a file name, save, and exit. Restart the test with merlin
      and selection "Load serialized state...". Load in the file you just created.
      You will the see the following:

      java.lang.ClassCastException: Assigning instance of class java.util.Hashtable to field java.awt.Font#fRequestedAttributes
              at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2270)
              at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)
              at java.awt.Font.readObject(Font.java:953)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2213)
              at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1410)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
              at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2262)
              at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)
              at java.awt.Component.readObject(Component.java:5723)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2213)
              at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1410)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
              at AWTConformanceTest.loadSerializedFile(AWTConformanceTest.java:424)
              at AWTConformanceTest.loadSerialize(AWTConformanceTest.java:439)
              at AWTConformanceTest.actionPerformed(AWTConformanceTest.java:371)
              at AWTConformanceTest.actionPerformed(AWTConformanceTest.java:337)
              at java.awt.MenuItem.processActionEvent(MenuItem.java:540)
              at java.awt.MenuItem.processEvent(MenuItem.java:504)
              at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:276)
              at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:266)
              at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:278)
              at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:266)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:425)
              at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:136)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:122)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:118)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
      Serialization error -- please file a bug report


      A similar error will appear if you attempt to read a merlin byte stream in
      kestrel.

            dougfelt Doug Felt (Inactive)
            dmendenhsunw David Mendenhall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: