Skip to content

Commit 94b0c32

Browse files
Remove redundant XmlUtils.elementValue()
1 parent bfe05fb commit 94b0c32

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private static Map<String, String> queryProperties(Element e, XPath xPath, Stri
286286
return XmlUtils.queryNodes(e, xPath, xpathExpr)
287287
.map(Element.class::cast)
288288
.collect(toMap(Node::getNodeName, selectedElement -> {
289-
return XmlUtils.elementValue(selectedElement, xPath);
289+
return selectedElement.getTextContent();
290290
}, (a, b) -> b));
291291
}
292292

src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,4 @@ public static Stream<Node> toStream(NamedNodeMap nodes) {
137137
return IntStream.range(0, v.getLength()).mapToObj(v::item);
138138
}).orElseGet(Stream::of);
139139
}
140-
141-
public static String elementValue(Element e, XPath xPath) {
142-
try {
143-
return queryNodes(e, xPath, "text()").map(Node::getNodeValue).collect(Collectors.joining());
144-
} catch (XPathExpressionException ex) {
145-
// Should never happen
146-
throw new RuntimeException(ex);
147-
}
148-
}
149140
}

test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/AppImageFileTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private static Stream<Arguments> testValidXml() {
229229
"<with-comment>a<!-- This is a comment -->b</with-comment>",
230230
"<add-launcher name='a'><name>foo</name><bar>foo</bar><service>true</service></add-launcher>",
231231
"<other><nested>false</nested></other>",
232-
"<another-other><child/></another-other>")
232+
"<another-other>A<child/>B</another-other>")
233233
)
234234
);
235235
}

0 commit comments

Comments
 (0)