harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r452411 - in /incubator/harmony/enhanced/classlib/trunk/modules/archive/src: main/java/java/util/zip/Inflater.java test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
Date Tue, 03 Oct 2006 10:58:20 GMT
Author: mloenko
Date: Tue Oct  3 03:58:20 2006
New Revision: 452411

URL: http://svn.apache.org/viewvc?view=rev&rev=452411
Log:
applied new patches for HARMONY-81
java.util.zip.Inflater.infalate() throws DataFormatException instead of actual number of uncompressed
bytes

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java?view=diff&rev=452411&r1=452410&r2=452411
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
Tue Oct  3 03:58:20 2006
@@ -168,6 +168,9 @@
 		// avoid int overflow, check null buf
 		if (off <= buf.length && nbytes >= 0 && off >= 0
 				&& buf.length - off >= nbytes) {
+            if (nbytes == 0)
+                return 0;
+
 			if (streamHandle == -1) {
                 throw new IllegalStateException();
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java?view=diff&rev=452411&r1=452410&r2=452411
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
Tue Oct  3 03:58:20 2006
@@ -702,4 +702,15 @@
         assertEquals(compressedDataLength, inf.getTotalOut());
         assertEquals(14, inf.getBytesWritten());
     }
+
+    /**
+     * @tests java.util.zip.Deflater#inflate(byte[], int, int)
+     */
+    public void testInflate() throws Exception {
+        // Regression for HARMONY-81 
+        Inflater inf = new Inflater();
+        int res = inf.inflate(new byte[0], 0, 0);
+
+        assertEquals(0, res);
+    }
 }



Mime
View raw message