You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2018/11/27 11:52:28 UTC

[sling-slingfeature-maven-plugin] branch master updated: SLING-8134: Fix an NPE when an external prototype is used.

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

pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 89da831  SLING-8134: Fix an NPE when an external prototype is used.
89da831 is described below

commit 89da831e2f52dd08d7668e442ed7ff6e55eb5173
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Tue Nov 27 12:52:20 2018 +0100

    SLING-8134: Fix an NPE when an external prototype is used.
---
 .../org/apache/sling/feature/maven/ProjectHelper.java   | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java b/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
index 06dfb2c..c491b0f 100644
--- a/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
+++ b/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
@@ -235,15 +235,18 @@ public abstract class ProjectHelper {
             final ArtifactResolver resolver,
             final ArtifactId id) {
         final Set<Artifact> artifacts = project.getDependencyArtifacts();
-        for(final Artifact artifact : artifacts) {
-            if ( artifact.getGroupId().equals(id.getGroupId())
-               && artifact.getArtifactId().equals(id.getArtifactId())
-               && artifact.getVersion().equals(id.getVersion())
-               && artifact.getType().equals(id.getVersion())
-               && ((id.getClassifier() == null && artifact.getClassifier() == null) || (id.getClassifier() != null && id.getClassifier().equals(artifact.getClassifier()))) ) {
-                return artifact;
+        if (artifacts != null) {
+            for(final Artifact artifact : artifacts) {
+                if ( artifact.getGroupId().equals(id.getGroupId())
+                   && artifact.getArtifactId().equals(id.getArtifactId())
+                   && artifact.getVersion().equals(id.getVersion())
+                   && artifact.getType().equals(id.getVersion())
+                   && ((id.getClassifier() == null && artifact.getClassifier() == null) || (id.getClassifier() != null && id.getClassifier().equals(artifact.getClassifier()))) ) {
+                    return artifact;
+                }
             }
         }
+
         final Artifact prjArtifact = new DefaultArtifact(id.getGroupId(),
                 id.getArtifactId(),
                 VersionRange.createFromVersion(id.getVersion()),