From: Olivier Lamy Date: Mon, 30 Jan 2012 12:43:53 +0000 (+0000) Subject: fix false warning on missing policy X-Git-Tag: archiva-1.4-M3~1436 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9a00a3a35565e1fa7f5c882301140781abd1b88c;p=archiva.git fix false warning on missing policy git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1237625 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java index 1c6b09847..09e9115f2 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java @@ -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 postPolicies; + /** + * see #initialize + * + * @todo these don't strictly belong in here + */ + private Map 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 {