maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r598901 - in /maven/artifact/trunk/src/main/java/org/apache/maven/artifact: InvalidRepositoryException.java UnknownRepositoryLayoutException.java repository/DefaultArtifactRepositoryFactory.java
Date Wed, 28 Nov 2007 08:16:15 GMT
Author: jdcasey
Date: Wed Nov 28 00:16:14 2007
New Revision: 598901

URL: http://svn.apache.org/viewvc?rev=598901&view=rev
Log:
Adding some error-reporting bits.

Modified:
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java?rev=598901&r1=598900&r2=598901&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
Wed Nov 28 00:16:14 2007
@@ -50,6 +50,13 @@
         this.repositoryId = repositoryId;
     }
 
+    protected InvalidRepositoryException( String message,
+                                          String repositoryId )
+    {
+        super( message );
+        this.repositoryId = repositoryId;
+    }
+
     public String getRepositoryId()
     {
         return repositoryId;

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java?rev=598901&r1=598900&r2=598901&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java
Wed Nov 28 00:16:14 2007
@@ -17,6 +17,13 @@
     private final String layoutId;
 
     public UnknownRepositoryLayoutException( String repositoryId,
+                                             String layoutId )
+    {
+        super( "Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId
);
+        this.layoutId = layoutId;
+    }
+
+    public UnknownRepositoryLayoutException( String repositoryId,
                                              String layoutId,
                                              ComponentLookupException e )
     {

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java?rev=598901&r1=598900&r2=598901&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java
Wed Nov 28 00:16:14 2007
@@ -43,7 +43,7 @@
     // FIXME: This is a non-ThreadLocal cache!!
     private final Map artifactRepositories = new HashMap();
 
-    /** @plexus.requirement role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
*/                                  
+    /** @plexus.requirement role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
*/
     private Map repositoryLayouts;
 
     public ArtifactRepositoryLayout getLayout( String layoutId )
@@ -60,9 +60,22 @@
     {
         ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) repositoryLayouts.get(
layoutId );
 
+        checkLayout( id, layoutId, layout );
+
         return createDeploymentArtifactRepository( id, url, layout, uniqueVersion );
     }
 
+    private void checkLayout( String repositoryId,
+                              String layoutId,
+                              ArtifactRepositoryLayout layout )
+        throws UnknownRepositoryLayoutException
+    {
+        if ( layout == null )
+        {
+            throw new UnknownRepositoryLayoutException( repositoryId, layoutId );
+        }
+    }
+
     public ArtifactRepository createDeploymentArtifactRepository( String id,
                                                                   String url,
                                                                   ArtifactRepositoryLayout
repositoryLayout,
@@ -79,6 +92,8 @@
         throws UnknownRepositoryLayoutException
     {
         ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) repositoryLayouts.get(
layoutId );
+
+        checkLayout( id, layoutId, layout );
 
         return createArtifactRepository( id, url, layout, snapshots, releases );
     }



Mime
View raw message