]> source.dussan.org Git - archiva.git/commitdiff
Fixing XMLException on non-existant proxy metadata file.
authorJoakim Erdfelt <joakime@apache.org>
Wed, 10 Oct 2007 21:35:50 +0000 (21:35 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Wed, 10 Oct 2007 21:35:50 +0000 (21:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@583623 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java

index 54374f485f2bd3e01e24a45eb8f7df8cec766bed..779cfcecacd6478d326075ba5e155fffd5ca4f07 100644 (file)
@@ -331,7 +331,7 @@ public class MetadataTools
         throws InitializationException
     {
         this.artifactPatterns = new ArrayList<String>();
-        this.proxies = new HashMap();
+        this.proxies = new HashMap<String, Set<String>>();
         initConfigVariables();
 
         configuration.addChangeListener( this );
@@ -342,6 +342,12 @@ public class MetadataTools
     {
         String metadataPath = getRepositorySpecificName( proxyId, toPath( reference ) );
         File metadataFile = new File( managedRepository.getRepoRoot(), metadataPath );
+        
+        if ( !metadataFile.exists() || !metadataFile.isFile() )
+        {
+            // Nothing to do. return null.
+            return null;
+        }
 
         try
         {
@@ -361,6 +367,12 @@ public class MetadataTools
     {
         String metadataPath = getRepositorySpecificName( proxyId, toPath( reference ) );
         File metadataFile = new File( managedRepository.getRepoRoot(), metadataPath );
+        
+        if ( !metadataFile.exists() || !metadataFile.isFile() )
+        {
+            // Nothing to do. return null.
+            return null;
+        }
 
         try
         {
@@ -659,14 +671,12 @@ public class MetadataTools
         {
             this.proxies.clear();
 
-            List proxyConfigs = configuration.getConfiguration().getProxyConnectors();
-            Iterator it = proxyConfigs.iterator();
-            while ( it.hasNext() )
+            List<ProxyConnectorConfiguration> proxyConfigs = configuration.getConfiguration().getProxyConnectors();
+            for( ProxyConnectorConfiguration proxyConfig: proxyConfigs )
             {
-                ProxyConnectorConfiguration proxyConfig = (ProxyConnectorConfiguration) it.next();
                 String key = proxyConfig.getSourceRepoId();
 
-                Set remoteRepoIds = this.proxies.get( key );
+                Set<String> remoteRepoIds = this.proxies.get( key );
 
                 if ( remoteRepoIds == null )
                 {