Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 38597 invoked from network); 1 Oct 2010 12:47:20 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Oct 2010 12:47:20 -0000 Received: (qmail 26403 invoked by uid 500); 1 Oct 2010 12:47:20 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 26260 invoked by uid 500); 1 Oct 2010 12:47:17 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 26244 invoked by uid 99); 1 Oct 2010 12:47:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Oct 2010 12:47:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Oct 2010 12:47:13 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C573B23889E0; Fri, 1 Oct 2010 12:46:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1003513 - in /harmony/enhanced/java/trunk/classlib/modules/archive/src: main/java/java/util/zip/Inflater.java test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java Date: Fri, 01 Oct 2010 12:46:51 -0000 To: commits@harmony.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101001124651.C573B23889E0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tellison Date: Fri Oct 1 12:46:51 2010 New Revision: 1003513 URL: http://svn.apache.org/viewvc?rev=1003513&view=rev Log: Apply fix for HARMONY-6637 ([classlib] [archive] Inflater.inflate() short-circuits on zero-length request, finished() never true for a zero-length data source) Modified: harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/zip/Inflater.java harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java Modified: harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/zip/Inflater.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/zip/Inflater.java?rev=1003513&r1=1003512&r2=1003513&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/zip/Inflater.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/zip/Inflater.java Fri Oct 1 12:46:51 2010 @@ -236,10 +236,6 @@ public class Inflater { throw new ArrayIndexOutOfBoundsException(); } - if (nbytes == 0) { - return 0; - } - if (streamHandle == -1) { throw new IllegalStateException(); } Modified: harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java?rev=1003513&r1=1003512&r2=1003513&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/zip/InflaterTest.java Fri Oct 1 12:46:51 2010 @@ -17,13 +17,14 @@ package org.apache.harmony.archive.tests.java.util.zip; import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.IOException; -import java.util.Arrays; -import java.util.zip.Adler32; import java.io.UnsupportedEncodingException; +import java.util.zip.Adler32; import java.util.zip.DataFormatException; import java.util.zip.Deflater; +import java.util.zip.DeflaterOutputStream; import java.util.zip.Inflater; import java.util.zip.ZipException; @@ -448,6 +449,28 @@ public class InflaterTest extends junit. infl2.end(); } + /* + * Regression test for HARMONY-6637 + */ + public void testInflateZero() throws Exception { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream( + byteArrayOutputStream); + deflaterOutputStream.close(); + byte[] input = byteArrayOutputStream.toByteArray(); + + Inflater inflater = new Inflater(); + inflater.setInput(input); + byte[] buffer = new byte[0]; + int numRead = 0; + while (!inflater.finished()) { + int inflatedChunkSize = inflater.inflate(buffer, numRead, + buffer.length - numRead); + numRead += inflatedChunkSize; + } + inflater.end(); + } + /** * @tests java.util.zip.Inflater#Inflater() */