-
Bug
-
Resolution: Fixed
-
P2
-
7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2229106 | 8 | Anton Litvinov | P2 | Closed | Fixed | b64 |
JDK-8019009 | 7u45 | Anton Litvinov | P2 | Closed | Fixed | b01 |
JDK-8010619 | 7u25 | Anton Litvinov | P2 | Closed | Fixed | b03 |
JDK-8004774 | 7u21 | Anton Litvinov | P2 | Closed | Fixed | b02 |
JDK-8009341 | 7u17 | Anton Litvinov | P2 | Resolved | Fixed | b31 |
JDK-8008152 | 7u15 | Anton Litvinov | P2 | Resolved | Fixed | b31 |
JDK-8003927 | 7u13 | Anton Litvinov | P2 | Resolved | Fixed | b06 |
JDK-8001982 | 7u10 | Anton Litvinov | P2 | Closed | Fixed | b17 |
JDK-8001655 | 7u9 | Anton Litvinov | P2 | Closed | Fixed | b32 |
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
Java HotSpot(TM) Client VM (build 23.1-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows and Oracle Solaris
A DESCRIPTION OF THE PROBLEM :
Deserialization of java.awt.Container, which has JComboBox and which was previously added to JFrame, produces NullPointerException on JDK 1.7, while on JDK 1.6 and 1.5 it does not.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the attached source code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both windows with titles “why why why ” and “deserialize ” and with identical contents should be displayed on the desktop. No exception should be thrown.
ACTUAL -
NullPointerException is thrown (see below).
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
at java.awt.Container.updateGraphicsData(Container.java:1149)
at java.awt.Container.updateGraphicsData(Container.java:1151)
at java.awt.Container.updateGraphicsData(Container.java:1151)
at java.awt.Container.updateGraphicsData(Container.java:1151)
at java.awt.Container.updateGraphicsData(Container.java:1151)
at java.awt.Component.setGraphicsConfiguration(Component.java:1152)
at java.awt.Window.setGraphicsConfiguration(Window.java:3144)
at java.awt.Window.initGC(Window.java:470)
at java.awt.Window.initDeserializedWindow(Window.java:2954)
at java.awt.Window.readObject(Window.java:3042)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.beans.PropertyChangeSupport.readObject(PropertyChangeSupport.java:468)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:498)
at java.awt.Component.readObject(Component.java:8681)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at MainTest.test(MainTest.java:65)
at MainTest.access$100(MainTest.java:15)
at MainTest$1.run(MainTest.java:91)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:671)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
REPRODUCIBILITY :
---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class MainTest
{
private static void createAndShowGUI()
{
//Create and set up the window.
JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("why why why");
JPanel mainPanel = new JPanel(new BorderLayout());
/**
* If replace JComboBox with other component like JLabel
* There is no issue happen.
*/
JComboBox status = new JComboBox();
status.addItem("123");
// JButton btn = new JButton("456");
mainPanel.add(new JLabel("xxx"), BorderLayout.NORTH);
mainPanel.add(status, BorderLayout.SOUTH);
frame.getContentPane().add(mainPanel);
//Display the window.
frame.pack();
frame.setVisible(true);
FileOutputStream f;
try
{
f = new FileOutputStream("tmp.vt");
ObjectOutput s = new ObjectOutputStream(f);
s.writeObject(mainPanel);
s.flush();
s.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
private static void test()
{
FileInputStream f;
try
{
f = new FileInputStream("tmp.vt");
ObjectInput s = new ObjectInputStream(f);
JPanel mp = (JPanel) s.readObject();
JFrame frame = new JFrame();
frame.getContentPane().add(mp);
frame.setTitle("deserialize");
frame.pack();
frame.setVisible(true);
s.close();
f.close();
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args)
{
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
createAndShowGUI();
test();
}
});
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8003927 JComboBox serialization fails in JDK 1.7
- Resolved
-
JDK-8008152 JComboBox serialization fails in JDK 1.7
- Resolved
-
JDK-8009341 JComboBox serialization fails in JDK 1.7
- Resolved
-
JDK-2229106 JComboBox serialization fails in JDK 1.7
- Closed
-
JDK-8001655 JComboBox serialization fails in JDK 1.7
- Closed
-
JDK-8001982 JComboBox serialization fails in JDK 1.7
- Closed
-
JDK-8004774 JComboBox serialization fails in JDK 1.7
- Closed
-
JDK-8010619 JComboBox serialization fails in JDK 1.7
- Closed
-
JDK-8019009 JComboBox serialization fails in JDK 1.7
- Closed
- relates to
-
JDK-8003982 new test javax/swing/AncestorNotifier/7193219/bug7193219.java failed on macosx
- Closed
-
JDK-6804747 Ensure consistent graphicsConfig member across components hierarchy
- Closed