incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1395270 - /incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java
Date Sun, 07 Oct 2012 10:38:43 GMT
Author: jlboudart
Date: Sun Oct  7 10:38:43 2012
New Revision: 1395270

URL: http://svn.apache.org/viewvc?rev=1395270&view=rev
Log:
Fix NPE when importing a plugin with missing artifacts

Modified:
    incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java?rev=1395270&r1=1395269&r2=1395270&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java
(original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/AbstractImport.java
Sun Oct  7 10:38:43 2012
@@ -117,23 +117,28 @@ public abstract class AbstractImport ext
      */
     protected void handleOtherResourceFile(ModuleRevisionId moduleRevisionId, String artifactName,
             String artifactExtension, File localResourceFile) {
-        StringBuilder sb = new StringBuilder();
-        sb.append(moduleRevisionId.getOrganisation());
-        sb.append("#");
-        sb.append(moduleRevisionId.getName());
-        sb.append(".");
-        if (!moduleRevisionId.getName().equals(artifactName)) {
-            sb.append(artifactName);
+        if (localResourceFile == null) {
+            getProject().log(
+                    "Can't find artifact " + artifactName + " ext" + artifactExtension
+                            + ". See resolution report to have details");
+        } else {
+            StringBuilder sb = new StringBuilder();
+            sb.append(moduleRevisionId.getOrganisation());
+            sb.append("#");
+            sb.append(moduleRevisionId.getName());
             sb.append(".");
-        }
-        sb.append(artifactExtension);
-        sb.append(".file");
-
-        getProject().log(
-                "registering location of artifact " + artifactName + " ext" + artifactExtension
+ " on "
-                        + sb.toString(), Project.MSG_DEBUG);
+            if (!moduleRevisionId.getName().equals(artifactName)) {
+                sb.append(artifactName);
+                sb.append(".");
+            }
+            sb.append(artifactExtension);
+            sb.append(".file");
 
-        getProject().setNewProperty(sb.toString(), localResourceFile.getAbsolutePath());
+            getProject().log(
+                    "registering location of artifact " + artifactName + " ext" + artifactExtension
+ " on "
+                            + sb.toString(), Project.MSG_DEBUG);
+            getProject().setNewProperty(sb.toString(), localResourceFile.getAbsolutePath());
+        }
     }
 
     /**



Mime
View raw message