use of org.apache.aries.util.IORuntimeException in project aries by apache.
the class BundleManifest method fromBundle.
/**
* Read a manifest from a jar input stream. This will find the manifest even if it is NOT
* the first file in the archive.
*
* @param is the jar input stream
* @return the bundle manifest
*/
public static BundleManifest fromBundle(InputStream is) {
JarInputStream jarIs = null;
try {
jarIs = new JarInputStream(is);
Manifest m = jarIs.getManifest();
if (m != null)
return new BundleManifest(m);
else {
ZipEntry entry;
while ((entry = jarIs.getNextEntry()) != null) {
if (entry.getName().equals(MANIFEST_PATH))
return new BundleManifest(jarIs);
}
return null;
}
} catch (IOException e) {
throw new IORuntimeException("IOException in BundleManifest()", e);
} finally {
IOUtils.close(jarIs);
}
}
Aggregations