You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2017/05/25 13:49:00 UTC

[14/50] [abbrv] ant-ivy git commit: Fix NullPointerException in dependencytree with no dependencies (IVY-1539)

Fix NullPointerException in dependencytree with no dependencies (IVY-1539)


Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/7217b9d2
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/7217b9d2
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/7217b9d2

Branch: refs/heads/xooki2asciidoc
Commit: 7217b9d270e31fe1e68803c8e25b0a03869f1556
Parents: f463013
Author: Maarten Coene <ma...@apache.org>
Authored: Wed Nov 9 01:48:48 2016 +0100
Committer: Maarten Coene <ma...@apache.org>
Committed: Wed Nov 9 01:48:48 2016 +0100

----------------------------------------------------------------------
 doc/release-notes.html                          |  1 +
 .../org/apache/ivy/ant/IvyDependencyTree.java   |  5 +++-
 .../apache/ivy/ant/IvyDependencyTreeTest.java   |  7 ++++++
 test/java/org/apache/ivy/ant/ivy-empty.xml      | 26 ++++++++++++++++++++
 4 files changed, 38 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/7217b9d2/doc/release-notes.html
----------------------------------------------------------------------
diff --git a/doc/release-notes.html b/doc/release-notes.html
index 265edba..bb8d3e8 100644
--- a/doc/release-notes.html
+++ b/doc/release-notes.html
@@ -58,6 +58,7 @@ http://issues.apache.org/jira/browse/ivy
  
 List of changes since Ivy 2.4.0:
 
+- FIX: NullPointerException in dependencytree with no dependencies (IVY-1539)
 - FIX: checkIfChanged is not settable attribute for checkdepsupdate ant task (IVY-1549)
 - FIX: ArrayIndexOutOfBoundsException when using a p2 repository for dependencies (IVY-1504)
 - FIX: fixdeps remove transitive 'kept' dependencies

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/7217b9d2/src/java/org/apache/ivy/ant/IvyDependencyTree.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyDependencyTree.java b/src/java/org/apache/ivy/ant/IvyDependencyTree.java
index f7c9fee..bb7c279 100644
--- a/src/java/org/apache/ivy/ant/IvyDependencyTree.java
+++ b/src/java/org/apache/ivy/ant/IvyDependencyTree.java
@@ -49,7 +49,10 @@ public class IvyDependencyTree extends IvyPostResolveTask {
             IvyNode dependency = (IvyNode) iterator.next();
             populateDependencyTree(dependency, mrid, report);
         }
-        printDependencies((List) dependencies.get(mrid), 0);
+        List dependencyList = (List) dependencies.get(mrid);
+        if (dependencyList != null) {
+            printDependencies(dependencyList, 0);
+        }
     }
 
     private void printDependencies(List/* <IvyNode> */dependencyList, int indent) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/7217b9d2/test/java/org/apache/ivy/ant/IvyDependencyTreeTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyDependencyTreeTest.java b/test/java/org/apache/ivy/ant/IvyDependencyTreeTest.java
index 0e85b2b..adfe37c 100644
--- a/test/java/org/apache/ivy/ant/IvyDependencyTreeTest.java
+++ b/test/java/org/apache/ivy/ant/IvyDependencyTreeTest.java
@@ -51,6 +51,13 @@ public class IvyDependencyTreeTest extends AntTaskTestCase {
         assertLogContaining("\\- org1#mod1.2;2.0");
     }
 
+    public void testEmpty() throws Exception {
+        dependencyTree.setFile(new File("test/java/org/apache/ivy/ant/ivy-empty.xml"));
+        dependencyTree.execute();
+        assertLogContaining("Dependency tree for apache-resolve-empty");
+        assertLogNotContaining("\\-");
+    }
+
     public void testWithResolveId() throws Exception {
         IvyResolve resolve = new IvyResolve();
         resolve.setProject(project);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/7217b9d2/test/java/org/apache/ivy/ant/ivy-empty.xml
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/ivy-empty.xml b/test/java/org/apache/ivy/ant/ivy-empty.xml
new file mode 100644
index 0000000..48c8759
--- /dev/null
+++ b/test/java/org/apache/ivy/ant/ivy-empty.xml
@@ -0,0 +1,26 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.0"> 
+	<info organisation="apache"
+	       module="resolve-empty"
+	       revision="1.0"
+	       status="release"
+	/>
+	<dependencies />
+</ivy-module>