Skip to content

Commit

Permalink
[MSHADE-428] Prevent null value in array of transformers (#229)
Browse files Browse the repository at this point in the history
As Plexus will silently add it as explain it in issue.
This fix merely improves user experience, but not throwing cryptic or totally misleading errors.

---

https://issues.apache.org/jira/browse/MSHADE-428
  • Loading branch information
cstamas committed May 28, 2024
1 parent b573b8c commit ade2e35
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -915,11 +915,16 @@ private List<Relocator> getRelocators() {
return relocators;
}

private List<ResourceTransformer> getResourceTransformers() {
private List<ResourceTransformer> getResourceTransformers() throws MojoExecutionException {
if (transformers == null) {
return Collections.emptyList();
}

for (ResourceTransformer transformer : transformers) {
if (transformer == null) {
throw new MojoExecutionException(
"Failed to create shaded artifact: parameter transformers contains null (double-check XML attribute)");
}
}
return Arrays.asList(transformers);
}

Expand Down

0 comments on commit ade2e35

Please sign in to comment.