// JarURLConnection#getJarFile() creates temporary copies of the JAR if
// the underlying resource is not a file URL. That can be slow so the
// InputStream for the resource is used
URL resourceURL = jarConn.getJarFileURL();
NonClosingJarInputStream jarInputStream = null;
String name = null;
try {
URLConnection resourceConn = resourceURL.openConnection();
resourceConn.setUseCaches(false);
jarInputStream =
new NonClosingJarInputStream(resourceConn.getInputStream());
JarEntry entry = jarInputStream.getNextJarEntry();
while (entry != null) {
name = entry.getName();
if (name.startsWith("META-INF/") && name.endsWith(".tld")) {
XmlErrorHandler handler = tldScanStream(jarInputStream);
handler.logFindings(log, jarConn.getURL() + name);
}
entry = jarInputStream.getNextJarEntry();
}
} catch (IOException ioe) {
log.warn(sm.getString("tldConfig.jarFail", jarConn.getURL() + name),
ioe);
} finally {
if (jarInputStream != null) {
try {
jarInputStream.reallyClose();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
}
}
}