This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tooling-support-source.git
commit cdd833f3de027ba49596db7b4b103abe17a9cff6 Author: Konrad Windszus <[email protected]> AuthorDate: Tue Nov 8 15:17:28 2016 +0000 SLING-6254 find the pom.xml with arbitrary GAVs to also supported forked Jetty bundles git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1768712 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/FelixJettySourceReferenceFinder.java | 44 ++++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java b/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java index b9d1ee5..704cfd8 100644 --- a/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java +++ b/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Collections; +import java.util.Enumeration; import java.util.List; import javax.xml.parsers.ParserConfigurationException; @@ -45,33 +46,36 @@ public class FelixJettySourceReferenceFinder implements SourceReferenceFinder { if ( !(jettyVersion instanceof String) ) { return Collections.emptyList(); } - - URL entry = bundle.getEntry("/META-INF/maven/org.apache.felix/org.apache.felix.http.jetty/pom.xml"); - - InputStream pom = null; - try { - pom = entry.openStream(); - + Enumeration entries = bundle.findEntries("META-INF/maven", "pom.xml", true); + if (entries != null && entries.hasMoreElements()) { + URL entry = (URL)entries.nextElement(); + InputStream pom = null; try { - SAXParserFactory parserFactory = SAXParserFactory.newInstance(); - SAXParser parser = parserFactory.newSAXParser(); - PomHandler handler = new PomHandler((String) jettyVersion); - parser.parse(new InputSource(pom), handler); + pom = entry.openStream(); - return handler.getReferences(); - } catch (SAXException e) { - throw new SourceReferenceException(e); - } catch (ParserConfigurationException e) { + try { + SAXParserFactory parserFactory = SAXParserFactory.newInstance(); + SAXParser parser = parserFactory.newSAXParser(); + PomHandler handler = new PomHandler((String) jettyVersion); + parser.parse(new InputSource(pom), handler); + + return handler.getReferences(); + } catch (SAXException e) { + throw new SourceReferenceException(e); + } catch (ParserConfigurationException e) { + throw new SourceReferenceException(e); + } finally { + IOUtils.closeQuietly(pom); + } + } catch (IOException e) { throw new SourceReferenceException(e); } finally { IOUtils.closeQuietly(pom); } - } catch (IOException e) { - throw new SourceReferenceException(e); - } finally { - IOUtils.closeQuietly(pom); + + } else { + return Collections.emptyList(); } - } } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
