You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ay...@apache.org on 2007/05/14 17:37:30 UTC
svn commit: r537883 -
/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java
Author: ayza
Date: Mon May 14 08:37:29 2007
New Revision: 537883
URL: http://svn.apache.org/viewvc?view=rev&rev=537883
Log:
Applying slightly truncated version of the patch from HARMONY-3703 ( [classlib][archive][netbeans] GZIPInputStream throws IOException when feeding from the network)
Modified:
harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java
Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java?view=diff&rev=537883&r1=537882&r2=537883
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/GZIPInputStream.java Mon May 14 08:37:29 2007
@@ -148,20 +148,15 @@
} else if (!eos) {
eos = true;
// Get non-compressed bytes read by fill
- int size = 0;
+ int size = inf.getRemaining();
byte[] b = new byte[8];
- int inB = inf.getTotalIn();
- if (inB > 0) {
- int diff = inB % buf.length;
- if (diff != 0 || len != buf.length) {
- size = len - diff;
- if (size > b.length) {
- size = b.length;
- }
- System.arraycopy(buf, diff, b, 0, size);
- }
+
+ if (size > b.length) {
+ size = b.length;
}
+ System.arraycopy(buf, len - size, b, 0, size);
readFully(b, size, b.length - size);
+
if (getLong(b, 0) != crc.getValue()) {
throw new IOException(Messages.getString("archive.20")); //$NON-NLS-1$
}