in atomos/src/main/java/org/apache/felix/atomos/impl/base/AtomosBase.java [1026:1064]
private Object getBundleContent(URL manifest)
{
if (JAR_PROTOCOL.equals(manifest.getProtocol()))
{
// Use a connection to get the JarFile this avoids having to parse the jar: URL
// For spring loader they support nested jars with additional !/
// For example:
// jar:file:/path/to/out.jar!/path/to/inner.jar!/META-INF/MANIFEST.MF
// Instead of dealing with that just get the JarFile directly that supports this
// embedded jar stuff
try
{
URLConnection conn = manifest.openConnection();
if (conn instanceof JarURLConnection)
{
return ((JarURLConnection) conn).getJarFile();
}
}
catch (IOException e)
{
// TODO log?
}
// TODO either log or add tracing to help debug issues
}
else if (FILE_PROTOCOL.equals(manifest.getProtocol()))
{
try
{
File f = new File(manifest.toURI());
// return two parents up from the manifest file
return f.getParentFile().getParentFile();
}
catch (URISyntaxException e)
{
throw new RuntimeException(e);
}
}
return null;
}