maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r680477 - in /maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src: main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
Date Mon, 28 Jul 2008 20:19:02 GMT
Author: jdcasey
Date: Mon Jul 28 13:19:02 2008
New Revision: 680477

URL: http://svn.apache.org/viewvc?rev=680477&view=rev
Log:
[MNG-2739] Adding compensation for null mirror-id, and unit test to verify that it will work.

Modified:
    maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
    maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java

Modified: maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java?rev=680477&r1=680476&r2=680477&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
(original)
+++ maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
Mon Jul 28 13:19:02 2008
@@ -81,6 +81,8 @@
 
     private static final String MAVEN_ARTIFACT_PROPERTIES = "META-INF/maven/org.apache.maven/maven-artifact/pom.properties";
 
+    private static int anonymousMirrorIdSeed = 0;
+    
     private PlexusContainer container;
 
     // TODO: proxies, authentication and mirrors are via settings, and should come in via
an alternate method - perhaps
@@ -110,7 +112,7 @@
     private RepositoryPermissions defaultRepositoryPermissions;
 
     private String httpUserAgent;
-    
+
     // TODO: this leaks the component in the public api - it is never released back to the
container
     public Wagon getWagon( Repository repository )
         throws UnsupportedProtocolException, WagonConfigurationException
@@ -957,6 +959,12 @@
                            String mirrorOf,
                            String url )
     {
+        if ( id == null )
+        {
+            id = "mirror-" + anonymousMirrorIdSeed++;
+            getLogger().warn( "You are using a mirror that doesn't declare an <id/>
element. Using \'" + id + "\' instead:\nId: " + id + "\nmirrorOf: " + mirrorOf + "\nurl: "
+ url + "\n" );
+        }
+        
         ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null );
 
         mirrors.put( mirrorOf, mirror );

Modified: maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java?rev=680477&r1=680476&r2=680477&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
(original)
+++ maven/components/branches/maven-2.0.10-RC/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
Mon Jul 28 13:19:02 2008
@@ -95,6 +95,11 @@
         return artifact;
     }
     
+    public void testAddMirrorWithNullRepositoryId()
+    {
+        wagonManager.addMirror( null, "test", "http://www.nowhere.com/" );
+    }
+    
     public void testGetArtifactSha1MissingMd5Present()
         throws IOException, UnsupportedProtocolException, TransferFailedException, ResourceDoesNotExistException
     {



Mime
View raw message