You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2024/05/28 11:29:37 UTC

(maven-shade-plugin) branch MSHADE-428 created (now 0a8b243)

This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a change to branch MSHADE-428
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git


      at 0a8b243  [MSHADE-428] Prevent null value in array of transformers

This branch includes the following new commits:

     new 0a8b243  [MSHADE-428] Prevent null value in array of transformers

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(maven-shade-plugin) 01/01: [MSHADE-428] Prevent null value in array of transformers

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch MSHADE-428
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git

commit 0a8b243a132d87c02f3dc32e96d30db6853e6b32
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue May 28 13:28:56 2024 +0200

    [MSHADE-428] Prevent null value in array of transformers
    
    As Plexus will silently add it as in issue.
    
    ---
    
    https://issues.apache.org/jira/browse/MSHADE-428
---
 src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
index 5d171b3..ccb469d 100644
--- a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
@@ -915,11 +915,17 @@ public class ShadeMojo extends AbstractMojo {
         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);
     }