]> source.dussan.org Git - archiva.git/commitdiff
fix false warning on missing policy
authorOlivier Lamy <olamy@apache.org>
Mon, 30 Jan 2012 12:43:53 +0000 (12:43 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 30 Jan 2012 12:43:53 +0000 (12:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1237625 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java

index 1c6b09847590a285c870a0046c071a0a98db155e..09e9115f2c2baac4836038d0f69328a2501472f2 100644 (file)
@@ -25,6 +25,7 @@ import org.apache.archiva.configuration.io.registry.ConfigurationRegistryWriter;
 import org.apache.archiva.policies.AbstractUpdatePolicy;
 import org.apache.archiva.policies.CachedFailuresPolicy;
 import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.DownloadErrorPolicy;
 import org.apache.archiva.policies.Policy;
 import org.apache.archiva.policies.PostDownloadPolicy;
 import org.apache.archiva.policies.PreDownloadPolicy;
@@ -123,6 +124,14 @@ public class DefaultArchivaConfiguration
      */
     private Map<String, PostDownloadPolicy> postPolicies;
 
+    /**
+     * see #initialize
+     *
+     * @todo these don't strictly belong in here
+     */
+    private Map<String, DownloadErrorPolicy> downloadErrorPolicies;
+
+
     /**
      * see #initialize
      * default-value="${user.home}/.m2/archiva.xml"
@@ -386,6 +395,12 @@ public class DefaultArchivaConfiguration
             return policy;
         }
 
+        policy = downloadErrorPolicies.get( policyId );
+        if ( policy != null )
+        {
+            return policy;
+        }
+
         return null;
     }
 
@@ -403,7 +418,8 @@ public class DefaultArchivaConfiguration
             return false;
         }
 
-        return ( prePolicies.containsKey( policyId ) || postPolicies.containsKey( policyId ) );
+        return ( prePolicies.containsKey( policyId ) || postPolicies.containsKey( policyId )
+            || downloadErrorPolicies.containsKey( policyId ) );
     }
 
     private Registry readDefaultConfiguration()
@@ -659,6 +675,7 @@ public class DefaultArchivaConfiguration
 
         this.postPolicies = componentContainer.buildMapWithRole( PostDownloadPolicy.class );
         this.prePolicies = componentContainer.buildMapWithRole( PreDownloadPolicy.class );
+        this.downloadErrorPolicies = componentContainer.buildMapWithRole( DownloadErrorPolicy.class );
         // Resolve expressions in the userConfigFilename and altConfigFilename
         try
         {