This patch (committed) fixes a NullPointerException when trying to deserialize a DefaultBoundedRangeModel:

2006-07-11  David Gilbert  <[EMAIL PROTECTED]>

        * javax/swing/DefaultBoundedRangeModel.java
        (readObject): New private method,
        (writeObject): Likewise.

Mauve test to follow.

Regards,

Dave
Index: javax/swing/DefaultBoundedRangeModel.java
===================================================================
RCS file: 
/sources/classpath/classpath/javax/swing/DefaultBoundedRangeModel.java,v
retrieving revision 1.14
diff -u -r1.14 DefaultBoundedRangeModel.java
--- javax/swing/DefaultBoundedRangeModel.java   27 Jul 2005 12:41:33 -0000      
1.14
+++ javax/swing/DefaultBoundedRangeModel.java   11 Jul 2006 15:03:54 -0000
@@ -1,6 +1,6 @@
 /* DefaultBoundedRangeModel.java -- Default implementation
    of BoundedRangeModel.
-   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,9 @@
 
 package javax.swing;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.EventListener;
 
@@ -440,4 +443,33 @@
   {
     return (ChangeListener[]) getListeners(ChangeListener.class);
   }
+  
+  /**
+   * Provides serialization support.
+   *
+   * @param stream  the output stream (<code>null</code> not permitted).
+   *
+   * @throws IOException  if there is an I/O error.
+   */
+  private void writeObject(ObjectOutputStream stream) 
+    throws IOException 
+  {
+    stream.defaultWriteObject();
+  }
+
+  /**
+   * Provides serialization support.
+   *
+   * @param stream  the input stream (<code>null</code> not permitted).
+   *
+   * @throws IOException  if there is an I/O error.
+   * @throws ClassNotFoundException  if there is a classpath problem.
+   */
+  private void readObject(ObjectInputStream stream)
+    throws ClassNotFoundException, IOException
+  {
+    stream.defaultReadObject();
+    listenerList = new EventListenerList();
+  }
+
 }

Reply via email to