in src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java [45:72]
public List<SourceReference> findSourceReferences(Bundle bundle) throws SourceReferenceException {
// the org.apache.felix.http.jetty bundle does not retain references to the source bundles
// so infer them from the X-Jetty-Version header
if (!"org.apache.felix.http.jetty".equals(bundle.getSymbolicName())) {
return Collections.emptyList();
}
final Object jettyVersion = bundle.getHeaders().get("X-Jetty-Version");
if ( !(jettyVersion instanceof String) ) {
log.warn("Could not retrieve Jetty version from bundle '{}' because header 'X-Jetty-Version' is not set!", bundle);
return Collections.emptyList();
}
Enumeration<URL> entries = bundle.findEntries("META-INF/maven", "pom.xml", true);
if (entries != null && entries.hasMoreElements()) {
URL entry = entries.nextElement();
try (InputStream pom = entry.openStream()) {
SAXParser parser = parserFactory.newSAXParser();
PomHandler handler = new PomHandler((String) jettyVersion);
parser.parse(new InputSource(pom), handler);
return handler.getReferences();
} catch (SAXException|ParserConfigurationException|IOException e) {
throw new SourceReferenceException(e);
}
} else {
log.warn("Could not find a pom.xml in bundle '{}'!", bundle);
return Collections.emptyList();
}
}