maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r925747 - in /maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader: DefaultDownloader.java DownloadException.java DownloadNotFoundException.java Downloader.java
Date Sun, 21 Mar 2010 10:02:07 GMT
Author: hboutemy
Date: Sun Mar 21 10:02:07 2010
New Revision: 925747

URL: http://svn.apache.org/viewvc?rev=925747&view=rev
Log:
o improved error messages
o added license header

Modified:
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java
    maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java?rev=925747&r1=925746&r2=925747&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
Sun Mar 21 10:02:07 2010
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.downloader;
 
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -28,27 +47,23 @@ public class DefaultDownloader
      */
     private ArtifactFactory artifactFactory;
 
-    public File download( String groupId,
-                          String artifactId,
-                          String version,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository,
-                         List remoteRepositories )
+    public File download( String groupId, String artifactId, String version, ArtifactRepository
archetypeRepository,
+                          ArtifactRepository localRepository, List remoteRepositories )
         throws DownloadException, DownloadNotFoundException
    {
         Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version,
Artifact.SCOPE_RUNTIME, "jar" );
 
-        List repositories = new ArrayList(remoteRepositories);
+        List repositories = new ArrayList( remoteRepositories );
         if ( repositories.isEmpty() && archetypeRepository != null )
         {
-            repositories.add(archetypeRepository);
+            repositories.add( archetypeRepository );
         }
-        else
-        if ( repositories.isEmpty() && localRepository != null )
+        else if ( repositories.isEmpty() && localRepository != null )
         {
-            repositories.add(localRepository);
-            
+            repositories.add( localRepository );
+
         }
+
         ArtifactRepository localRepo = localRepository;
         try
         {
@@ -56,21 +71,18 @@ public class DefaultDownloader
         }
         catch ( ArtifactResolutionException e )
         {
-            throw new DownloadException( "Error downloading.", e );
+            throw new DownloadException( "Error downloading " + artifact.getId() + ".", e
);
         }
         catch ( ArtifactNotFoundException e )
         {
-            throw new DownloadNotFoundException( "Requested download does not exist.", e
);
+            throw new DownloadNotFoundException( "Requested " + artifact.getId() + " download
does not exist.", e );
         }
 
         return artifact.getFile();
     }
-    public File downloadOld( String groupId,
-                          String artifactId,
-                          String version,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository,
-                         List remoteRepositories )
+
+    public File downloadOld( String groupId, String artifactId, String version, ArtifactRepository
archetypeRepository,
+                             ArtifactRepository localRepository, List remoteRepositories
)
         throws DownloadException, DownloadNotFoundException
    {
         Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version,
Artifact.SCOPE_RUNTIME, "jar" );
@@ -80,11 +92,11 @@ public class DefaultDownloader
         }
         catch ( ArtifactResolutionException e )
         {
-            throw new DownloadException( "Error downloading.", e );
+            throw new DownloadException( "Error downloading " + artifact.getId() + ".", e
);
         }
         catch ( ArtifactNotFoundException e )
         {
-            throw new DownloadNotFoundException( "Requested download does not exist.", e
);
+            throw new DownloadNotFoundException( "Requested " + artifact.getId() + " download
does not exist.", e );
         }
 
         return artifact.getFile();

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java?rev=925747&r1=925746&r2=925747&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadException.java
Sun Mar 21 10:02:07 2010
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.downloader;
 
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 /**
  * @author Jason van Zyl
  */
@@ -11,8 +30,7 @@ public class DownloadException
         super( string );
     }
 
-    public DownloadException( String string,
-                              Throwable throwable )
+    public DownloadException( String string, Throwable throwable )
     {
         super( string, throwable );
     }

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java?rev=925747&r1=925746&r2=925747&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DownloadNotFoundException.java
Sun Mar 21 10:02:07 2010
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.downloader;
 
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 /**
  * @author Jason van Zyl
  */
@@ -11,8 +30,7 @@ public class DownloadNotFoundException
         super( string );
     }
 
-    public DownloadNotFoundException( String string,
-                                      Throwable throwable )
+    public DownloadNotFoundException( String string, Throwable throwable )
     {
         super( string, throwable );
     }

Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java?rev=925747&r1=925746&r2=925747&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java
(original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/downloader/Downloader.java
Sun Mar 21 10:02:07 2010
@@ -1,5 +1,24 @@
 package org.apache.maven.archetype.downloader;
 
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
 import java.io.File;
@@ -12,19 +31,11 @@ public interface Downloader
 {
     String ROLE = Downloader.class.getName();
 
-    public File download( String groupId,
-                          String artifactId,
-                          String version,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository,
-                          List remoteRepositories )
+    public File download( String groupId, String artifactId, String version, ArtifactRepository
archetypeRepository,
+                          ArtifactRepository localRepository, List remoteRepositories )
         throws DownloadException, DownloadNotFoundException;
 
-    public File downloadOld( String groupId,
-                          String artifactId,
-                          String version,
-                          ArtifactRepository archetypeRepository,
-                          ArtifactRepository localRepository,
-                          List remoteRepositories )
+    public File downloadOld( String groupId, String artifactId, String version, ArtifactRepository
archetypeRepository,
+                             ArtifactRepository localRepository, List remoteRepositories
)
         throws DownloadException, DownloadNotFoundException;
 }



Mime
View raw message