From 86f52644848b046c10db68ea59750fa2e81cdc22 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Tue, 12 Oct 2004 14:21:48 +0000 Subject: 2004-10-12 Michael Koch * java/util/zip/GZIPInputStream.java (GZIP_MAGIC): Fixed value. (readHeader): Fixed GZIP_MAGIC handling. * java/util/zip/GZIPOutputStream.java (GZIPOutputStream): Likewise. --- java/util/zip/GZIPInputStream.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'java/util/zip/GZIPInputStream.java') diff --git a/java/util/zip/GZIPInputStream.java b/java/util/zip/GZIPInputStream.java index 117cf69d9..1c9793312 100644 --- a/java/util/zip/GZIPInputStream.java +++ b/java/util/zip/GZIPInputStream.java @@ -55,7 +55,7 @@ public class GZIPInputStream /** * The magic number found at the start of a GZIP stream. */ - public static final int GZIP_MAGIC = 0x1f8b; + public static final int GZIP_MAGIC = 0x8b1f; /** * The mask for bit 0 of the flag byte. @@ -198,12 +198,12 @@ public class GZIPInputStream return; } headCRC.update(magic); - if (magic != (GZIP_MAGIC >> 8)) - throw new IOException("Error in GZIP header, first byte doesn't match"); - - magic = in.read(); if (magic != (GZIP_MAGIC & 0xff)) throw new IOException("Error in GZIP header, second byte doesn't match"); + + magic = in.read(); + if (magic != (GZIP_MAGIC >> 8)) + throw new IOException("Error in GZIP header, first byte doesn't match"); headCRC.update(magic); /* 2. Check the compression type (must be 8) */ -- cgit v1.2.1