[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Verifying zip entries that don't exist in the JarFile
From: |
Mark Wielaard |
Subject: |
[cp-patches] Verifying zip entries that don't exist in the JarFile |
Date: |
Mon, 21 Feb 2005 21:13:35 +0100 |
Hi,
Sometimes a jar signature file contains signatures for .class files not
included in the jar file itself (which is probably a packaging problem).
This patch handles such situations gracefully.
2005-02-21 Mark Wielaard <address@hidden>
* java/util/jar/JarFile.java (verifyHashes): Check whether ZipEntry
exists.
Without this patch we would throw a NullPointerException in the middle
of loading the jar file. Found by playing a bit with Netx a GPLed JNLP
implementation which kind of works (unfortunately only when turning off
the build in SecurityManager which goes into some infinite loop, which
need investigation). Some of the simpler jnlp examples actually start up
with a recent gij.
OK to commit?
Cheers,
Mark
Index: java/util/jar/JarFile.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/jar/JarFile.java,v
retrieving revision 1.15
diff -u -r1.15 JarFile.java
--- java/util/jar/JarFile.java 29 Dec 2004 11:15:02 -0000 1.15
+++ java/util/jar/JarFile.java 21 Feb 2005 20:01:50 -0000
@@ -726,7 +726,14 @@
byte[] entryBytes = null;
try
{
- entryBytes = readManifestEntry(super.getEntry(entry));
+ ZipEntry e = super.getEntry(entry);
+ if (e == null)
+ {
+ if (DEBUG)
+ debug("verifyHashes: no entry '" + entry + "'");
+ return false;
+ }
+ entryBytes = readManifestEntry(e);
}
catch (IOException ioe)
{
signature.asc
Description: This is a digitally signed message part
- [cp-patches] Verifying zip entries that don't exist in the JarFile,
Mark Wielaard <=