gnodet commented on code in PR #11426:
URL: https://github.com/apache/maven/pull/11426#discussion_r2564044968
##########
impl/maven-testing/src/main/java/org/apache/maven/api/plugin/testing/MojoExtension.java:
##########
@@ -269,7 +272,23 @@ public Object resolveParameter(ParameterContext
parameterContext, ExtensionConte
.map(ConfigurationContainer::getConfiguration)
.orElseGet(() -> XmlNode.newInstance("config"));
List<XmlNode> children = mojoParameters.stream()
- .map(mp -> XmlNode.newInstance(mp.name(), mp.value()))
+ .map(mp -> {
+ String value = mp.value();
+ if (!mp.xml()) {
+ // Treat as plain text - escape XML special
characters
+ value = value.replace("&", "&")
+ .replace("<", "<")
+ .replace(">", ">")
+ .replace("\"", """)
+ .replace("'", "'");
+ }
+ String s = '<' + mp.name() + '>' + value + "</" +
mp.name() + '>';
+ try {
+ return XmlService.read(new StringReader(s));
+ } catch (XMLStreamException e) {
+ throw new MavenException("Unable to parse xml: " +
e + "\n" + s, e);
Review Comment:
```suggestion
throw new MavenException("Unable to parse xml: "
+ e + System.lineSeparator() + s, e);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]