for (WebXml fragment : fragments) {
URL url = fragment.getURL();
Jar jar = null;
InputStream is = null;
ServletContainerInitializer sci = null;
try {
if ("jar".equals(url.getProtocol())) {
jar = JarFactory.newInstance(url);
is = jar.getInputStream(SCI_LOCATION);
} else if ("file".equals(url.getProtocol())) {
String path = url.getPath();
File file = new File(path, SCI_LOCATION);
if (file.exists()) {
is = new FileInputStream(file);
}
}
if (is != null) {
sci = getServletContainerInitializer(is);
}
} catch (IOException ioe) {
log.error(sm.getString(
"contextConfig.servletContainerInitializerFail", url,
context.getName()));
ok = false;
return;
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
// Ignore
}
}
if (jar != null) {
jar.close();
}
}
if (sci == null) {
continue;
}
initializerClassMap.put(sci, new HashSet<Class<?>>());
HandlesTypes ht =
sci.getClass().getAnnotation(HandlesTypes.class);
if (ht != null) {
Class<?>[] types = ht.value();
if (types != null) {
for (Class<?> type : types) {
if (type.isAnnotation()) {