while (enumeration.hasMoreElements()) {
String url = enumeration.nextElement();
if (!url.endsWith(".jar")) {
continue;
}
WebFragmentDocument webFragmentDocument = null;
ZipInputStream in = null;
try {
in = new ZipInputStream(bundle.getEntry(url).openStream());
ZipEntry entry;
while ((entry = in.getNextEntry()) != null) {
if (entry.getName().equals("META-INF/web-fragment.xml")) {
webFragmentDocument = (WebFragmentDocument) XmlBeansUtil.parse(in);
break;
}
}
} catch (IOException e) {
logger.error("Fail to parse web-fragment.xml files in jar " + url, e);
throw new DeploymentException("Fail to scan web-fragment.xml files", e);
} catch (XmlException e) {
logger.error("Fail to parse web-fragment.xml files in jar " + url, e);
throw new DeploymentException("Fail to scan web-fragment.xml files", e);
} finally {
IOUtils.close(in);
}
if (webFragmentDocument == null) {
webFragmentDocument = WebFragmentDocument.Factory.newInstance();
webFragmentDocument.setWebFragment(WebFragmentType.Factory.newInstance());
}
jarUrlWebFragmentDocumentMap.put(url, webFragmentDocument);
}
webFragmentEntries = sortWebFragments(earContext, module, bundle, webApp, jarUrlWebFragmentDocumentMap);
} else {