Commit b0b74f37 by Mark Wielaard Committed by Mark Wielaard

JarFile.java (JarFile(String, boolean)): Read manifest when verify is true.

       * java/util/jar/JarFile.java (JarFile(String, boolean)): Read manifest
       when verify is true.
       (JarFile(File, boolean)): Likewise.
       (manifestRead): Set manifestRead field correctly.

From-SVN: r62545
parent 5ccbcd8c
2003-02-07 Mark Wielaard <mark@klomp.org>
* java/util/jar/JarFile.java (JarFile(String, boolean)): Read manifest
when verify is true.
(JarFile(File, boolean)): Likewise.
(manifestRead): Set manifestRead field correctly.
2003-02-07 Stephen Crawley <crawley@dstc.edu.au> 2003-02-07 Stephen Crawley <crawley@dstc.edu.au>
* java/math/BigDecimal(valueOf): fix DiagBigDecimal val008, val013 * java/math/BigDecimal(valueOf): fix DiagBigDecimal val008, val013
......
/* JarFile.java - Representation of a jar file /* JarFile.java - Representation of a jar file
Copyright (C) 2000 Free Software Foundation, Inc. Copyright (C) 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -71,10 +71,10 @@ public class JarFile extends ZipFile ...@@ -71,10 +71,10 @@ public class JarFile extends ZipFile
*/ */
private Manifest manifest; private Manifest manifest;
/** Wether to verify the manifest and all entries. */ /** Whether to verify the manifest and all entries. */
private boolean verify; private boolean verify;
/** Wether the has already been loaded. */ /** Whether the has already been loaded. */
private boolean manifestRead = false; private boolean manifestRead = false;
// Constructors // Constructors
...@@ -109,6 +109,11 @@ public class JarFile extends ZipFile ...@@ -109,6 +109,11 @@ public class JarFile extends ZipFile
FileNotFoundException, IOException FileNotFoundException, IOException
{ {
super(fileName); super(fileName);
if (verify)
{
manifest = readManifest();
verify();
}
} }
/** /**
...@@ -141,6 +146,11 @@ public class JarFile extends ZipFile ...@@ -141,6 +146,11 @@ public class JarFile extends ZipFile
IOException IOException
{ {
super(file); super(file);
if (verify)
{
manifest = readManifest();
verify();
}
} }
/** /**
...@@ -165,6 +175,11 @@ public class JarFile extends ZipFile ...@@ -165,6 +175,11 @@ public class JarFile extends ZipFile
FileNotFoundException, IOException, IllegalArgumentException FileNotFoundException, IOException, IllegalArgumentException
{ {
super(file, mode); super(file, mode);
if (verify)
{
manifest = readManifest();
verify();
}
} }
// Methods // Methods
...@@ -196,15 +211,18 @@ public class JarFile extends ZipFile ...@@ -196,15 +211,18 @@ public class JarFile extends ZipFile
if (manEntry != null) if (manEntry != null)
{ {
InputStream in = super.getInputStream(manEntry); InputStream in = super.getInputStream(manEntry);
manifestRead = true;
return new Manifest(in); return new Manifest(in);
} }
else else
{ {
manifestRead = true;
return null; return null;
} }
} }
catch (IOException ioe) catch (IOException ioe)
{ {
manifestRead = true;
return null; return null;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment