JarFile.java (JarFile(String, boolean)): Read manifest when verify is true.
authorMark Wielaard <mark@klomp.org>
Fri, 7 Feb 2003 21:33:05 +0000 (21:33 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Fri, 7 Feb 2003 21:33:05 +0000 (21:33 +0000)
       * 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

libjava/ChangeLog
libjava/java/util/jar/JarFile.java

index 493794200f71e14f34e4dcbefdf0753df0be34f8..37240097bd1fab12a823ee872106d593ce001965 100644 (file)
@@ -1,3 +1,10 @@
+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>
 
        * java/math/BigDecimal(valueOf): fix DiagBigDecimal val008, val013
index d6fd9846b6ee9ba969bdcf65872d752460886c2c..394b51af6d0616ed45f16c1f8aeb399322d7ca44 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -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,11 @@ public class JarFile extends ZipFile
     FileNotFoundException, IOException
   {
     super(fileName);
+    if (verify)
+      {
+       manifest = readManifest();
+       verify();
+      }
   }
 
   /**
@@ -141,6 +146,11 @@ public class JarFile extends ZipFile
     IOException
   {
     super(file);
+    if (verify)
+      {
+       manifest = readManifest();
+       verify();
+      }
   }
 
   /**
@@ -165,6 +175,11 @@ public class JarFile extends ZipFile
     FileNotFoundException, IOException, IllegalArgumentException
   {
     super(file, mode);
+    if (verify)
+      {
+       manifest = readManifest();
+       verify();
+      }
   }
 
   // Methods
@@ -196,15 +211,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;
       }
   }