JDK-6690068 : REG: serialization proccess throws NPE
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u10
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-04-17
  • Updated: 2012-03-22
  • Resolved: 2008-05-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u10 b23Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Deserialization of any container throws NPE due to a missed initilization inside readObject() method.
 private void readObject(ObjectInputStream s)throws ClassNotFoundException, IOException{
        ObjectInputStream.GetField f = s.readFields();
        Component [] tmpComponent = (Component[])f.get("component", EMPTY_ARRAY);
>>        component.addAll(Arrays.asList(tmpComponent));

This is a regression of CR 6616323.

Comments
SUGGESTED FIX http://sa.sfbay.sun.com/projects/awt_data/6u10/6690068/
18-04-2008

EVALUATION Collection isn't initialized while de-serial process runs. Should assign it some empty ArrayList.
18-04-2008

SUGGESTED FIX Should assign some default value to this field: private void readObject(ObjectInputStream s)throws ClassNotFoundException, IOException{ ObjectInputStream.GetField f = s.readFields(); Component [] tmpComponent = (Component[])f.get("component", EMPTY_ARRAY); + component = new java.util.ArrayList<Component>(); component.addAll(Arrays.asList(tmpComponent));
17-04-2008