harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r485530 - in /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 Mon, 11 Dec 2006 06:48:00 GMT
Author: liangyx
Date: Sun Dec 10 22:47:58 2006
New Revision: 485530

URL: http://svn.apache.org/viewvc?view=rev&rev=485530
Log:
HARMONY-2508 ([classlib][archive]Inflater.inflate throws DataFormatException if it needs input
on Harmony while RI not)

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

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java?view=diff&rev=485530&r1=485529&r2=485530
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Inflater.java
Sun Dec 10 22:47:58 2006
@@ -174,7 +174,11 @@
 			if (streamHandle == -1) {
                 throw new IllegalStateException();
             }
-
+            
+            if (needsInput()) {
+                return 0;
+            }
+            
 			boolean neededDict = needsDictionary;
 			needsDictionary = false;
 			int result = inflateImpl(buf, off, nbytes, streamHandle);

Modified: 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/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java?view=diff&rev=485530&r1=485529&r2=485530
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java
Sun Dec 10 22:47:58 2006
@@ -712,5 +712,11 @@
         int res = inf.inflate(new byte[0], 0, 0);
 
         assertEquals(0, res);
+
+        // Regression for HARMONY-2508
+        Inflater inflater = new Inflater();
+        byte[] b = new byte[1024];
+        assertEquals(0, inflater.inflate(b));
+        inflater.end();       
     }
 }



Mime
View raw message