You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2010/02/14 20:37:00 UTC

svn commit: r910065 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/BufferedOutputStream.java test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java

Author: hindessm
Date: Sun Feb 14 19:37:00 2010
New Revision: 910065

URL: http://svn.apache.org/viewvc?rev=910065&view=rev
Log:
Adding regression test and fix for dacapo eclipse regression caused by
commit:

  r835972 | jessewilson | 2009-11-13 20:08:08 +0000 (Fri, 13 Nov 2009)

which added a throw to BufferedOutputStream.flush() in the case of a
closed stream.  The RI does not throw an exception in this case.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedOutputStream.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedOutputStream.java?rev=910065&r1=910064&r2=910065&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedOutputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/BufferedOutputStream.java Sun Feb 14 19:37:00 2010
@@ -88,10 +88,6 @@
      */
     @Override
     public synchronized void flush() throws IOException {
-        if (buf == null) {
-            throw new IOException(Messages.getString("luni.24")); //$NON-NLS-1$
-        }
-
         flushInternal();
         out.flush();
     }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java?rev=910065&r1=910064&r2=910065&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/BufferedOutputStreamTest.java Sun Feb 14 19:37:00 2010
@@ -807,6 +807,15 @@
         }
     }
 
+    // Regression test for flush on closed stream
+    public void test_flush_on_closed_stream() throws IOException {
+        BufferedOutputStream bos =
+            new BufferedOutputStream(
+                new ByteArrayOutputStream());
+        bos.close();
+        bos.flush(); // RI does not throw exception
+    }
+
     /**
      * Tears down the fixture, for example, close a network connection. This
      * method is called after a test is executed.