summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Leuner <jewel@pixie.co.za>2003-02-03 14:24:32 +0000
committerJohn Leuner <jewel@pixie.co.za>2003-02-03 14:24:32 +0000
commit57cc51d8d00b5542d3259c61f32bd5db40ed66f9 (patch)
treebd13a8c0b92d7aa2d096e74ab1003e0e22cc8fba
parentf611325602e246112b84b0cd3f5d82bb0f05eda2 (diff)
downloadclasspath-57cc51d8d00b5542d3259c61f32bd5db40ed66f9.tar.gz
* java/util/zip/InflaterInputStream.java: fix problem with 0-length
reads from end of file * java/util/zip/ZipInputStream.java: idem * java/util/jar/JarFile.java: read manifest
-rw-r--r--ChangeLog6
-rw-r--r--java/util/jar/JarFile.java19
-rw-r--r--java/util/zip/InflaterInputStream.java3
-rw-r--r--java/util/zip/ZipInputStream.java2
4 files changed, 28 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5db03a741..fa90df38d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-02-03 John Leuner <jewel@debian.org>
+ * java/util/zip/InflaterInputStream.java: fix problem with 0-length
+ reads from end of file
+ * java/util/zip/ZipInputStream.java: idem
+ * java/util/jar/JarFile.java: read manifest
+
2003-02-02 C. Brian Jones <cbj@gnu.org>
* doc/www.gnu.org/home.wml: add Jikes RVM to list of JVMs; update
diff --git a/java/util/jar/JarFile.java b/java/util/jar/JarFile.java
index d6fd9846b..895761302 100644
--- a/java/util/jar/JarFile.java
+++ b/java/util/jar/JarFile.java
@@ -71,10 +71,10 @@ public class JarFile extends ZipFile
*/
private Manifest manifest;
- /** Wether to verify the manifest and all entries. */
+ /** Whether to verify the manifest and all entries. */
private boolean verify;
- /** Wether the has already been loaded. */
+ /** Whether the has already been loaded. */
private boolean manifestRead = false;
// Constructors
@@ -109,6 +109,10 @@ public class JarFile extends ZipFile
FileNotFoundException, IOException
{
super(fileName);
+ if (verify) {
+ manifest = readManifest();
+ verify();
+ }
}
/**
@@ -141,6 +145,10 @@ public class JarFile extends ZipFile
IOException
{
super(file);
+ if (verify) {
+ manifest = readManifest();
+ verify();
+ }
}
/**
@@ -165,6 +173,10 @@ public class JarFile extends ZipFile
FileNotFoundException, IOException, IllegalArgumentException
{
super(file, mode);
+ if (verify) {
+ manifest = readManifest();
+ verify();
+ }
}
// Methods
@@ -196,15 +208,18 @@ public class JarFile extends ZipFile
if (manEntry != null)
{
InputStream in = super.getInputStream(manEntry);
+ manifestRead = true;
return new Manifest(in);
}
else
{
+ manifestRead = true;
return null;
}
}
catch (IOException ioe)
{
+ manifestRead = true;
return null;
}
}
diff --git a/java/util/zip/InflaterInputStream.java b/java/util/zip/InflaterInputStream.java
index 6c72161d2..aa8a01b4c 100644
--- a/java/util/zip/InflaterInputStream.java
+++ b/java/util/zip/InflaterInputStream.java
@@ -182,6 +182,9 @@ public class InflaterInputStream extends FilterInputStream {
*/
public int read(byte[] b, int off, int len) throws IOException
{
+
+ if (len == 0) return 0;
+
for (;;)
{
int count;
diff --git a/java/util/zip/ZipInputStream.java b/java/util/zip/ZipInputStream.java
index c4905978d..789a7c60e 100644
--- a/java/util/zip/ZipInputStream.java
+++ b/java/util/zip/ZipInputStream.java
@@ -286,6 +286,8 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
*/
public int read(byte[] b, int off, int len) throws IOException
{
+ if(len == 0)
+ return 0;
if (crc == null)
throw new IOException("Stream closed.");
if (entry == null)