Appended is a patch to avoid a NullPointerException if close is called multiple times.  This matches the logic that is already in java.io.BufferedReader.   Could someone please apply it?

Since preparations for classpath 0.06 are underway, I'm increasing the scope of the nightly regression tests we run on Jikes RVM with the classpath cvs head.  This bug surfaced on two of our test cases: running Eclipse (and creating a class in a Java project) and running XSLTmark (driver for testing the performance of xalan).

thanks,

--dave

Index: java/io/InputStreamReader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/InputStreamReader.java,v
retrieving revision 1.12
diff -u -r1.12 InputStreamReader.java
--- java/io/InputStreamReader.java                 11 Jun 2003 17:21:27 -0000                 1.12
+++ java/io/InputStreamReader.java                 29 Jul 2003 14:39:18 -0000
@@ -137,8 +137,12 @@
   */
  public void close() throws IOException
  {
-    in.close();
-    in = null;
+    synchronized (lock)
+      {
+                 if (in != null)
+                   in.close();
+                 in = null;
+      }
  }

  /**
Index: java/util/zip/InflaterInputStream.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/zip/InflaterInputStream.java,v
retrieving revision 1.8
diff -u -r1.8 InflaterInputStream.java
--- java/util/zip/InflaterInputStream.java                 18 Jul 2003 12:26:38 -0000                 1.8
+++ java/util/zip/InflaterInputStream.java                 29 Jul 2003 14:39:18 -0000
@@ -135,8 +135,12 @@
   */
  public void close() throws IOException
  {
-    in.close();
-    in = null;
+    synchronized (this)
+      {
+                 if (in != null)
+                   in.close();
+                 in = null;
+      }
  }

  /**
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to