This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: java.util.zip.ZipFile fix
- To: java-patches at sourceware dot cygnus dot com
- Subject: Patch: java.util.zip.ZipFile fix
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Sun, 21 May 2000 11:26:16 +1200
This patch fixes a bug in the ZipFile class. Now the interpreter can
finally load data from compressed .jar and .zip files!
I'm going to check this in.
regards
[ bryce ]
Fix for PR libgcj/228:
* java/util/zip/ZipFile.java (getInputStream): Create inflater with
nowrapper option.
* java/util/zip/natInflater.cc (inflate): Throw zlib's error message
with DataFormatException.
Index: natInflater.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/zip/natInflater.cc,v
retrieving revision 1.6
diff -u -r1.6 natInflater.cc
--- natInflater.cc 2000/03/07 19:55:28 1.6
+++ natInflater.cc 2000/05/20 23:17:42
@@ -117,7 +117,8 @@
break;
case Z_DATA_ERROR:
- _Jv_Throw (new java::util::zip::DataFormatException);
+ _Jv_Throw (new java::util::zip::DataFormatException
+ (s->msg == NULL ? NULL : JvNewStringLatin1 (s->msg)));
break;
case Z_MEM_ERROR:
Index: ZipFile.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/zip/ZipFile.java,v
retrieving revision 1.8
diff -u -r1.8 ZipFile.java
--- ZipFile.java 2000/04/11 20:02:48 1.8
+++ ZipFile.java 2000/05/20 23:17:43
@@ -133,7 +133,9 @@
InputStream is = new ByteArrayInputStream (buffer);
if (ze.getMethod() == ZipEntry.DEFLATED)
- is = new InflaterInputStream (is);
+ // Data in zipfile entries does not have a zlib header, so construct
+ // an Inflater with the `nowrapper' option.
+ is = new InflaterInputStream (is, new Inflater (true), 512);
return is;
}