Summary
getSupplement(Xpp3Dom) swallows XML parse errors and returns a null Model, and the caller then dereferences it unconditionally → NullPointerException instead of a clean error message.
src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:1008-1033
protected Model getSupplement(Xpp3Dom supplementModelXml) throws MojoExecutionException {
...
try {
model = modelReader.read(new StringReader(supplementModelXml.toString()));
...
} catch (IOException e) {
getLog().warn("Unable to read supplemental XML: " + e.getMessage(), e);
} catch (XmlPullParserException e) {
getLog().warn("Unable to parse supplemental XML: " + e.getMessage(), e);
}
return model; // null when the inner <project> element is malformed
}
loadSupplements() then calls:
Model m = getSupplement(dom);
supplementMap.put(generateSupplementMapKey(m.getGroupId(), m.getArtifactId()), m); // NPE if m == null
src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:1082-1083
Impact
A malformed <project> entry inside supplemental-models.xml (e.g. an invalid model element that MavenXpp3Reader rejects) crashes the build with an unhelpful NullPointerException rather than the intended warning/error path. Note the outer wrapper XML is parsed by SupplementalDataModelXpp3Reader in loadSupplements() and fails there cleanly; only the inner <project> DOM→Model conversion hits this path.
Suggested fix
throw a MojoExecutionException on parse failure instead of returning null.
Summary
getSupplement(Xpp3Dom)swallows XML parse errors and returns a nullModel, and the caller then dereferences it unconditionally →NullPointerExceptioninstead of a clean error message.src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:1008-1033loadSupplements()then calls:src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:1082-1083Impact
A malformed
<project>entry insidesupplemental-models.xml(e.g. an invalid model element thatMavenXpp3Readerrejects) crashes the build with an unhelpfulNullPointerExceptionrather than the intended warning/error path. Note the outer wrapper XML is parsed bySupplementalDataModelXpp3ReaderinloadSupplements()and fails there cleanly; only the inner<project>DOM→Model conversion hits this path.Suggested fix
throw a
MojoExecutionExceptionon parse failure instead of returning null.