Skip to content

Commit

Permalink
Merge pull request #6274 from reckart/issues/6273
Browse files Browse the repository at this point in the history
Issue #6273: Accessing POM via XPath is very slow
  • Loading branch information
pkriens authored Sep 20, 2024
2 parents 9d7f81a + fdbde0d commit 8955576
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions biz.aQute.repository/src/aQute/maven/provider/POM.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,15 @@ private boolean isTrue(String other) {
return "true".equalsIgnoreCase(other);
}

private String get(Element dependency, String name, String deflt) throws XPathExpressionException {
String value = xp.evaluate(name, dependency);
if (value == null || value.isEmpty())
return Strings.trim(deflt);
private String get(Element dependency, String name, String deflt) {
var matchingElements = dependency.getElementsByTagName(name);
if (matchingElements.getLength() > 0) {
var value = matchingElements.item(0).getTextContent();
if (value != null && !value.isEmpty())
return Strings.trim(replaceMacros(value));
}

return Strings.trim(replaceMacros(value));
return Strings.trim(deflt);
}

private String getOrSet(String key, String deflt) {
Expand Down

0 comments on commit 8955576

Please sign in to comment.