classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug fix for java.io.InputReaderStream.close and java.util.zip.InflaterIn


From: David P Grove
Subject: bug fix for java.io.InputReaderStream.close and java.util.zip.InflaterInputStream.close
Date: Tue, 29 Jul 2003 10:42:26 -0400


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;
+      }
  }

  /**

reply via email to

[Prev in Thread] Current Thread [Next in Thread]