harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r554950 - in /harmony/enhanced/classlib/trunk/modules/archive/src: main/java/java/util/zip/ZipOutputStream.java test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java
Date Tue, 10 Jul 2007 14:02:32 GMT
Author: tonywu
Date: Tue Jul 10 07:02:31 2007
New Revision: 554950

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

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java?view=diff&rev=554950&r1=554949&r2=554950
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipOutputStream.java
Tue Jul 10 07:02:31 2007
@@ -370,7 +370,7 @@
     public void write(byte[] buffer, int off, int nbytes)
 			throws java.io.IOException {
 		// avoid int overflow, check null buf
-		if ((off > buffer.length) || (nbytes < 0) || (off < 0)
+		if ((off < 0 || (nbytes < 0) || off > buffer.length)
 				|| (buffer.length - off < nbytes)) {
 			throw new IndexOutOfBoundsException();
 		}

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java?view=diff&rev=554950&r1=554949&r2=554950
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipOutputStreamTest.java
Tue Jul 10 07:02:31 2007
@@ -227,6 +227,14 @@
         } catch (IndexOutOfBoundsException e) {
             // expected
         }
+        
+        // Regression for HARMONY-4405
+        try {
+            zip.write(null, 0, -2);
+            fail("Should throw IndexOutOfBoundsException");
+        } catch (IndexOutOfBoundsException e) {
+            // ecpected
+        }
     }
 
     /**



Mime
View raw message