Package: ivy-debian-helper
Version: 1.0
Tags: patch
X-Debbugs-CC: Simon Ruggier <simon.rugg...@gmail.com>

I discovered this while attempting to package Solr 6.3. Here's the
relevant snippet of output from Ivy:

    ivy-configure:
    [ivy:configure] :: loading settings :: file =
/tmp/pbuilder/solr/lucene/top-level-ivy-settings.xml
    [ivy:configure] [ivy-debian-helper] Loading the Maven rules...

    resolve:
    [ivy:retrieve] [ivy-debian-helper] Replacing
org.locationtech.spatial4j:spatial4j:jar:0.6  ->
com.spatial4j:spatial4j:jar:0.5
    [ivy:retrieve] [ivy-debian-helper] Replacing
org.slf4j:slf4j-api:jar:1.7.7  ->  org.slf4j:slf4j-api:jar:debian
    [ivy:retrieve] [ivy-debian-helper] Passing through
org.slf4j:slf4j-parent:jar:debian
    [ivy:retrieve]
    [ivy:retrieve] :: problems summary ::
    [ivy:retrieve] :::: ERRORS
    [ivy:retrieve]     null
    [ivy:retrieve]
    [ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

    BUILD FAILED
    /tmp/pbuilder/solr/build.xml:264: The following error occurred
while executing this line:
    /tmp/pbuilder/solr/lucene/build.xml:126: The following error
occurred while executing this line:
    /tmp/pbuilder/solr/lucene/common-build.xml:2157: The following
error occurred while executing this line:
    /tmp/pbuilder/solr/lucene/common-build.xml:409: impossible to
resolve dependencies:
        java.lang.NullPointerException
        at 
org.debian.ivy.DebianDependencyResolver.download(DebianDependencyResolver.java:194)
        at 
org.apache.ivy.core.resolve.ResolveEngine.downloadArtifacts(ResolveEngine.java:394)

See attached for a patch that fixes it.
From 2734708630f32403c75020411fae4d4ca338c1b6 Mon Sep 17 00:00:00 2001
From: Simon Ruggier <si...@platform.sh>
Date: Wed, 21 Dec 2016 12:33:19 -0500
Subject: [PATCH] Fix NullPointerException on null artifact origin

---
 src/main/java/org/debian/ivy/DebianDependencyResolver.java | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/debian/ivy/DebianDependencyResolver.java b/src/main/java/org/debian/ivy/DebianDependencyResolver.java
index 95e51ff..8ca18ca 100644
--- a/src/main/java/org/debian/ivy/DebianDependencyResolver.java
+++ b/src/main/java/org/debian/ivy/DebianDependencyResolver.java
@@ -191,12 +191,14 @@ public class DebianDependencyResolver extends IBiblioResolver {
             Artifact artifact = replacedArtifacts.get(artifactDownloadReport.getArtifact());
             
             ArtifactDownloadReport artifactDownloadReport2 = new ArtifactDownloadReport(artifact);
-            String location = artifactDownloadReport.getArtifactOrigin().getLocation();
-            
-            if (location != null) {
-                artifactDownloadReport2.setArtifactOrigin(new ArtifactOrigin(artifact, false, location));
-                artifactDownloadReport2.setLocalFile(artifactDownloadReport.getLocalFile());
-                artifactDownloadReport2.setSize(artifactDownloadReport.getSize());
+            ArtifactOrigin origin = artifactDownloadReport.getArtifactOrigin();
+            if (origin != null) {
+                String location = origin.getLocation();
+                if (location != null) {
+                    artifactDownloadReport2.setArtifactOrigin(new ArtifactOrigin(artifact, false, location));
+                    artifactDownloadReport2.setLocalFile(artifactDownloadReport.getLocalFile());
+                    artifactDownloadReport2.setSize(artifactDownloadReport.getSize());
+                }
             }
             
             artifactDownloadReport2.setDownloadStatus(artifactDownloadReport.getDownloadStatus());
-- 
2.1.4

Reply via email to