in src/main/java/org/apache/sling/installer/core/impl/Util.java [59:98]
private static Manifest getManifest(final RegisteredResource rsrc, final Logger logger)
throws IOException {
final InputStream ins = rsrc.getInputStream();
Manifest result = null;
if ( ins != null ) {
JarInputStream jis = null;
try {
jis = new JarInputStream(ins);
result= jis.getManifest();
// SLING-2288 : if this is a jar file, but the manifest is not the first entry
// log a warning
if ( rsrc.getURL().endsWith(".jar") && result == null ) {
logger.warn("Resource {} does not have the manifest as its first entry in the archive. If this is " +
"a bundle, make sure to put the manifest first in the jar file.", rsrc.getURL());
}
} finally {
// close the jar stream or the inputstream, if the jar
// stream is set, we don't need to close the input stream
// since closing the jar stream closes the input stream
if (jis != null) {
try {
jis.close();
} catch (IOException ignore) {
}
} else {
try {
ins.close();
} catch (IOException ignore) {
}
}
}
} else {
logger.debug("Unable to get input stream from {}", rsrc);
}
return result;
}