diff options
author | Edwin L. Punzalan <epunzalan@apache.org> | 2006-06-16 06:01:50 +0000 |
---|---|---|
committer | Edwin L. Punzalan <epunzalan@apache.org> | 2006-06-16 06:01:50 +0000 |
commit | 1e5e969496ac10c8d4e27bec627935e59d66f8a1 (patch) | |
tree | a8ac109e7ce29f0c571e999eb6cd27813dff68bd /maven-repository-indexer | |
parent | 565f3f28444b974b02b500ee149f7d50bbccb1c6 (diff) | |
download | archiva-1e5e969496ac10c8d4e27bec627935e59d66f8a1.tar.gz archiva-1e5e969496ac10c8d4e27bec627935e59d66f8a1.zip |
Changed boolean Digester methods to throw an exception instead for a more informative failure reason
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@414745 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'maven-repository-indexer')
3 files changed, 10 insertions, 37 deletions
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java index 8a1f8fb55..c86908109 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java @@ -22,11 +22,10 @@ import org.apache.lucene.index.Term; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.repository.digest.Digester; +import org.apache.maven.repository.digest.DigesterException; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; -import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; @@ -158,18 +157,10 @@ public class ArtifactRepositoryIndex sha1sum = digester.createChecksum( artifact.getFile(), Digester.SHA1 ); md5sum = digester.createChecksum( artifact.getFile(), Digester.MD5 ); } - catch ( NoSuchAlgorithmException e ) + catch ( DigesterException e ) { throw new RepositoryIndexException( "Unable to create a checksum", e ); } - catch ( FileNotFoundException e ) - { - throw new RepositoryIndexException( "Error reading from artifact file", e ); - } - catch ( IOException e ) - { - throw new RepositoryIndexException( "Error reading from artifact file", e ); - } try { diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java index a0a298c84..20eb10375 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java @@ -26,21 +26,20 @@ import org.apache.lucene.document.Field; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.repository.digest.Digester; +import org.apache.maven.repository.digest.DigesterException; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.Reader; -import java.security.NoSuchAlgorithmException; -import java.util.Enumeration; -import java.util.Collections; -import java.util.List; import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; import java.util.Iterator; +import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; @@ -150,15 +149,7 @@ public class EclipseRepositoryIndex { md5 = digester.createChecksum( artifactFile, "MD5" ); } - catch ( FileNotFoundException e ) - { - throw new RepositoryIndexException( "Unable to compute checksum.", e ); - } - catch ( NoSuchAlgorithmException e ) - { - throw new RepositoryIndexException( "Unable to compute checksum.", e ); - } - catch ( IOException e ) + catch ( DigesterException e ) { throw new RepositoryIndexException( "Unable to compute checksum.", e ); } diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java index 0a13c9716..7396ecc02 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java @@ -28,12 +28,11 @@ import org.apache.maven.model.Model; import org.apache.maven.model.Plugin; import org.apache.maven.model.ReportPlugin; import org.apache.maven.repository.digest.Digester; +import org.apache.maven.repository.digest.DigesterException; import org.codehaus.plexus.util.StringUtils; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; -import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; @@ -310,17 +309,9 @@ public class PomRepositoryIndex { return digester.createChecksum( new File( file ), algorithm ); } - catch ( FileNotFoundException e ) + catch ( DigesterException e ) { - throw new RepositoryIndexException( e.getMessage(), e ); - } - catch ( IOException e ) - { - throw new RepositoryIndexException( e.getMessage(), e ); - } - catch ( NoSuchAlgorithmException e ) - { - throw new RepositoryIndexException( e.getMessage(), e ); + throw new RepositoryIndexException( "Failed to create checksum", e ); } } |