You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/06/10 12:47:20 UTC

svn commit: r666058 - in /ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver: AbstractResolver.java DependencyResolver.java

Author: xavier
Date: Tue Jun 10 03:47:20 2008
New Revision: 666058

URL: http://svn.apache.org/viewvc?rev=666058&view=rev
Log:
FIX: NPE in AbstractResolver.exists() if a resource cannot be found  (IVY-831)

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java?rev=666058&r1=666057&r2=666058&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java Tue Jun 10 03:47:20 2008
@@ -193,6 +193,15 @@
      */
     public boolean exists(Artifact artifact) {
         DownloadReport dr = download(new Artifact[] {artifact}, new DownloadOptions());
+        if (dr == null) {
+            /*
+             * according to IVY-831, it seems that this actually happen sometime, while the contract
+             * of DependencyResolver says that it should never return null
+             */
+            throw new IllegalStateException(
+                "null download report returned by " + getName() 
+                + " when trying to download " + artifact);
+        }
         ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
         return adr.getDownloadStatus() != DownloadStatus.FAILED;
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java?rev=666058&r1=666057&r2=666058&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java Tue Jun 10 03:47:20 2008
@@ -70,6 +70,24 @@
      */
     ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data);
 
+    /**
+     * Download artifacts with specified DownloadOptions.
+     * <p>
+     * The resolver will always make a best effort, and do not stop when an artifact is not
+     * available. It rather continue to attempt to download other requested artifacts, and report
+     * what has been done in the returned DownloadReport.
+     * </p>
+     * <p>
+     * The returned DownloadReport is never <code>null</code>, and always contain an
+     * {@link ArtifactDownloadReport} for each requested Artifact.
+     * </p>
+     * 
+     * @param artifacts
+     *            an array of artifacts to download
+     * @param options
+     *            options to apply for this download
+     * @return a DownloadReport with details about each Artifact download.
+     */
     DownloadReport download(Artifact[] artifacts, DownloadOptions options);
 
     boolean exists(Artifact artifact);