scan(jar, jarEntry);
}
public void scan(Path jar, JarEntry jarEntry)
{
ZipScanner scan = null;
try {
boolean isScan = true;
boolean isValidScan = false;
try {
if (isScan && jar.canRead()) {
scan = new ZipScanner(jar);
}
if (scan != null && scan.open()) {
while (scan.next()) {
char []buffer = scan.getNameBuffer();
int length = scan.getNameLength();
// server/249b, env/009r
if (length > 0 && buffer[length - 1] == '/') {
length--;
}
add(buffer, length, jarEntry);
}
isValidScan = true;
}
} catch (Exception e) {
log.log(Level.FINER, e.toString(), e);
isScan = false;
}
if (! isValidScan && jar.canRead()) {
ZipFile file = new ZipFile(jar.getNativePath());
try {
Enumeration<? extends ZipEntry> e = file.entries();
while (e.hasMoreElements()) {
ZipEntry entry = e.nextElement();
String name = entry.getName();
add(name, jarEntry);
// server/249b
/*
if (name.endsWith("/"))
name = name.substring(0, name.length() - 1);
*/
}
} finally {
file.close();
}
}
} catch (IOException e) {
if (jar.canRead())
log.log(Level.WARNING, e.toString(), e);
else
log.log(Level.FINER, e.toString(), e);
} finally {
if (scan != null)
scan.close();
}
}