Author: maartenc
Date: Wed Dec  3 12:50:45 2008
New Revision: 723065

URL: http://svn.apache.org/viewvc?rev=723065&view=rev
Log:
FIX: NullPointerException when resolving module wihout revision in the pattern 
(IVY-980) + junit test

Added:
    ant/ivy/core/trunk/test/repositories/norev/ivy-latest.xml
    ant/ivy/core/trunk/test/repositories/norev/module3/
    ant/ivy/core/trunk/test/repositories/norev/module3/module3.jar
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=723065&r1=723064&r2=723065&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Dec  3 12:50:45 2008
@@ -94,6 +94,7 @@
 - FIX: IO problem while parsing ivy file (Resetting to invalid mark) (IVY-975)
 - FIX: Cannot parse maven2 poms containing an UTF-8 BOM
 - FIX: listing possible token values doesn't work properly for the ibiblio 
resolver
+- FIX: NullPointerException when resolving module wihout revision in the 
pattern (IVY-980)
 
    2.0.0-rc2
 =====================================

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java?rev=723065&r1=723064&r2=723065&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java 
(original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java 
Wed Dec  3 12:50:45 2008
@@ -456,6 +456,8 @@
             if (!isDynamic) {
                 resolvedMrid = ModuleRevisionId.newInstance(
                     resolvedMrid, dependencyConstraint.getRevision());
+            } else if (ivyRef == null) {
+                resolvedMrid = 
systemMd.getMetadataArtifact().getModuleRevisionId();
             } else if (ivyRef.getRevision() == null || 
ivyRef.getRevision().length() == 0) {
                 resolvedMrid = ModuleRevisionId.newInstance(resolvedMrid, 
"working@"
                     + getName());

Modified: 
ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=723065&r1=723064&r2=723065&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java 
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java 
Wed Dec  3 12:50:45 2008
@@ -267,6 +267,15 @@
         assertFalse(report.hasError());
     }
 
+    public void testResolveLatestWithNoRevisionInPattern() throws Exception {
+        Ivy ivy = new Ivy();
+        ivy.configure(new 
File("test/repositories/norev/ivysettings.xml").toURL());
+        ResolveReport report = ivy.resolve(new 
File("test/repositories/norev/ivy-latest.xml").toURL(),
+            getResolveOptions(new String[] {"*"}));
+        assertNotNull(report);
+        assertFalse(report.hasError());
+     }
+
     public void testResolveNoRevisionInDep() throws Exception {
         // mod1.4 depends on mod1.6, in which the ivy file has no revision
         ResolveReport report = ivy.resolve(new File(

Added: ant/ivy/core/trunk/test/repositories/norev/ivy-latest.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/norev/ivy-latest.xml?rev=723065&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/norev/ivy-latest.xml (added)
+++ ant/ivy/core/trunk/test/repositories/norev/ivy-latest.xml Wed Dec  3 
12:50:45 2008
@@ -0,0 +1,27 @@
+<!--
+   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="myorg" module="module1"/>
+    <configurations>
+       <conf name="myconf"/>
+    </configurations>
+    <dependencies>
+        <dependency conf="myconf -> *" org="myorg" name="module3" rev="+" />
+       </dependencies>
+</ivy-module>

Added: ant/ivy/core/trunk/test/repositories/norev/module3/module3.jar
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/norev/module3/module3.jar?rev=723065&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/norev/module3/module3.jar (added)
+++ ant/ivy/core/trunk/test/repositories/norev/module3/module3.jar Wed Dec  3 
12:50:45 2008
@@ -0,0 +1 @@
+.
\ No newline at end of file


Reply via email to