|
java.util.zip.ZipFile and its subclass java.util.jar.JarFile has a minor gotcha when using getEntry(String); leading slashes are not ignored. For example:
final JarFile jarFile = new JarFile("rt.jar");
System.out.println(jarFile.getEntry("/java/lang/Object.class"));
System.out.println(jarFile.getEntry("java/lang/Object.class"));
will return:
null
java/lang/Object.class
In general, this is not a big deal. But when manually parsing URLs (don't ask) such as:
jar:file://rt.jar!/java/lang/Object.class
it can bite you in the butt.
|