You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2016/11/08 15:17:28 UTC
svn commit: r1768712 -
/sling/trunk/tooling/support/source/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java
Author: kwin
Date: Tue Nov 8 15:17:28 2016
New Revision: 1768712
URL: http://svn.apache.org/viewvc?rev=1768712&view=rev
Log:
SLING-6254 find the pom.xml with arbitrary GAVs to also supported forked Jetty bundles
Modified:
sling/trunk/tooling/support/source/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java
Modified: sling/trunk/tooling/support/source/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/source/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java?rev=1768712&r1=1768711&r2=1768712&view=diff
==============================================================================
--- sling/trunk/tooling/support/source/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java (original)
+++ sling/trunk/tooling/support/source/src/main/java/org/apache/sling/tooling/support/source/impl/FelixJettySourceReferenceFinder.java Tue Nov 8 15:17:28 2016
@@ -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 FelixJettySourceReferenceFi
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();
}
-
}
}