strip leading slashes from name in ZipFile.getEntry

This is necessary to allow resource loading of the form
Foo.class.getResourceAsStream("/foo.txt") from JAR files.
This commit is contained in:
Joel Dice
2011-07-26 09:09:04 -06:00
parent 801327752a
commit 792653e190

View File

@ -74,6 +74,9 @@ public class ZipFile {
}
protected ZipEntry getEntry(EntryFactory factory, String name) {
while (name.startsWith("/")) {
name = name.substring(1);
}
Integer pointer = index.get(name);
return (pointer == null ? null : factory.makeEntry(window, pointer));
}