harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r552834 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/OutputStream.java test/api/common/tests/api/java/io/PipedOutputStreamTest.java
Date Tue, 03 Jul 2007 13:27:49 GMT
Author: tonywu
Date: Tue Jul  3 06:27:48 2007
New Revision: 552834

URL: http://svn.apache.org/viewvc?view=rev&rev=552834
Log:
Fix Harmony-4311 ([classlib][luni] Compatibility: OutputStream.write(null, off, len) exception
throwing order differs on Harmony and RI)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStream.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/PipedOutputStreamTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStream.java?view=diff&rev=552834&r1=552833&r2=552834
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStream.java Tue
Jul  3 06:27:48 2007
@@ -90,7 +90,7 @@
      */
     public void write(byte buffer[], int offset, int count) throws IOException {
         // avoid int overflow, check null buffer
-        if (offset < 0 || offset > buffer.length || count < 0
+        if (offset > buffer.length || offset < 0 || count < 0
                 || count > buffer.length - offset) {
             throw new IndexOutOfBoundsException(Msg.getString("K002f")); //$NON-NLS-1$
         }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/PipedOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/PipedOutputStreamTest.java?view=diff&rev=552834&r1=552833&r2=552834
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/PipedOutputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/PipedOutputStreamTest.java
Tue Jul  3 06:27:48 2007
@@ -199,6 +199,16 @@
                     "IndexOutOfBoundsException rather than a subclass expected",
                     IndexOutOfBoundsException.class, t.getClass());
         }
+        
+        // Regression for HARMONY-4311
+        try {
+            pis = new PipedInputStream();
+            PipedOutputStream out = new PipedOutputStream(pis);
+            out.write(null, -10, 10);
+            fail("should throw NullPointerException.");
+        } catch (NullPointerException e) {
+            // expected
+        } 
     }
 
 	/**



Mime
View raw message