]> source.dussan.org Git - archiva.git/commitdiff
copy collections to avoid ConcurrentModificationException
authorOlivier Lamy <olamy@apache.org>
Sun, 23 Nov 2014 12:02:06 +0000 (23:02 +1100)
committerOlivier Lamy <olamy@apache.org>
Sun, 23 Nov 2014 12:02:06 +0000 (23:02 +1100)
archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java

index 0daa2d2013f46ea739fd8f659020bab5be560c5a..11eda06f32fe735cc1c7d837ad14adca76b04631 100644 (file)
@@ -134,7 +134,7 @@ public class DefaultRepositoryProxyConnectors
     @Inject
     private UrlFailureCache urlFailureCache;
 
-    private Map<String, List<ProxyConnector>> proxyConnectorMap = new HashMap<>();
+    private Map<String, List<ProxyConnector>> proxyConnectorMap = new ConcurrentHashMap<>();
 
     private Map<String, ProxyInfo> networkProxyMap = new ConcurrentHashMap<>();
 
@@ -457,7 +457,7 @@ public class DefaultRepositoryProxyConnectors
         boolean metadataNeedsUpdating = false;
         long originalTimestamp = getLastModified( localFile );
 
-        List<ProxyConnector> connectors = getProxyConnectors( repository );
+        List<ProxyConnector> connectors = new ArrayList<>( getProxyConnectors( repository ) );
         for ( ProxyConnector connector : connectors )
         {
             if ( connector.isDisabled() )