summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2009-03-10 01:35:35 +0000
committerBrett Porter <brett@apache.org>2009-03-10 01:35:35 +0000
commite75840b71f2ef6a4569f40bc6c332a7133ff9813 (patch)
treefee3977e5d7a1959399d15644ea50f3542516fb2
parent0fcfb7e339c2815c3b90143b4610fb1f6f7af7ee (diff)
downloadarchiva-e75840b71f2ef6a4569f40bc6c332a7133ff9813.tar.gz
archiva-e75840b71f2ef6a4569f40bc6c332a7133ff9813.zip
[MRM-1102] clean up layout exceptions
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@751940 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java24
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java4
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java13
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java48
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java2
7 files changed, 60 insertions, 39 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
index 4f21ff1b5..e40bb8d27 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
@@ -160,19 +160,19 @@ public class MetadataUpdaterConsumer
public void processFile( String path )
throws ConsumerException
{
- //Ignore paths like .indexer etc
- if (path.startsWith("."))
- return;
-
- try
- {
- ArtifactReference artifact = repository.toArtifactReference( path );
- updateVersionMetadata( artifact, path );
- updateProjectMetadata( artifact, path );
- }
- catch ( LayoutException e )
+ // Ignore paths like .indexer etc
+ if ( !path.startsWith( "." ) )
{
- throw new ConsumerException( "Unable to convert to artifact reference: " + path, e );
+ try
+ {
+ ArtifactReference artifact = repository.toArtifactReference( path );
+ updateVersionMetadata( artifact, path );
+ updateProjectMetadata( artifact, path );
+ }
+ catch ( LayoutException e )
+ {
+ log.info( "Not processing path that is not an artifact: " + path + " (" + e.getMessage() + ")" );
+ }
}
}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java
index 545f62f86..46b0e9b12 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java
@@ -28,6 +28,8 @@ import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.events.RepositoryListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Base class for all repository purge tasks.
@@ -36,6 +38,8 @@ import org.apache.maven.archiva.repository.events.RepositoryListener;
public abstract class AbstractRepositoryPurge
implements RepositoryPurge
{
+ protected Logger log = LoggerFactory.getLogger( AbstractRepositoryPurge.class );
+
protected final ManagedRepositoryContent repository;
protected final List<RepositoryListener> listeners;
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
index e5a7aef92..bdca2646e 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
@@ -135,14 +135,14 @@ public class DaysOldRepositoryPurge
}
}
}
- catch ( LayoutException le )
- {
- throw new RepositoryPurgeException( le.getMessage(), le );
- }
catch ( ContentNotFoundException e )
{
throw new RepositoryPurgeException( e.getMessage(), e );
}
+ catch ( LayoutException e )
+ {
+ log.debug( "Not processing file that is not an artifact: " + e.getMessage() );
+ }
}
private Calendar uniqueSnapshotToCalendar( String version )
@@ -179,7 +179,6 @@ public class DaysOldRepositoryPurge
}
private void doPurgeAllRelated( ArtifactReference reference )
- throws LayoutException
{
try
{
@@ -188,8 +187,8 @@ public class DaysOldRepositoryPurge
}
catch ( ContentNotFoundException e )
{
- // Nothing to do here.
- // TODO: Log this?
+ // Nothing to do here - it means the repository would have been constructed incorrectly
+ log.debug( e.getMessage(), e );
}
}
}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java
index 5d5588b07..140113371 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java
@@ -77,7 +77,7 @@ public interface ManagedRepositoryContent
* @throws LayoutException
*/
public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
- throws ContentNotFoundException, LayoutException;
+ throws ContentNotFoundException;
/**
* <p>
@@ -128,7 +128,7 @@ public interface ManagedRepositoryContent
* @throws LayoutException
*/
public Set<String> getVersions( VersionedReference reference )
- throws ContentNotFoundException, LayoutException;
+ throws ContentNotFoundException;
/**
* Determines if the artifact referenced exists in the repository.
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java
index b0e91c3b0..342807035 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java
@@ -26,6 +26,8 @@ import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* AbstractDefaultRepositoryContent - common methods for working with default (maven 2) layout.
@@ -34,6 +36,8 @@ import org.apache.maven.archiva.repository.layout.LayoutException;
*/
public abstract class AbstractDefaultRepositoryContent
{
+ protected Logger log = LoggerFactory.getLogger( AbstractDefaultRepositoryContent.class );
+
public static final String MAVEN_METADATA = "maven-metadata.xml";
protected static final char PATH_SEPARATOR = '/';
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java
index a19cfa763..242d1413a 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java
@@ -19,6 +19,11 @@ package org.apache.maven.archiva.repository.content;
* under the License.
*/
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.configuration.FileTypes;
@@ -31,11 +36,6 @@ import org.apache.maven.archiva.repository.ContentNotFoundException;
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.layout.LayoutException;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* ManagedDefaultRepositoryContent
*
@@ -89,7 +89,7 @@ public class ManagedDefaultRepositoryContent
}
public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
- throws ContentNotFoundException, LayoutException
+ throws ContentNotFoundException
{
File artifactFile = toFile( reference );
File repoDir = artifactFile.getParentFile();
@@ -122,14 +122,21 @@ public class ManagedDefaultRepositoryContent
if ( filetypes.matchesArtifactPattern( relativePath ) )
{
- ArtifactReference artifact = toArtifactReference( relativePath );
-
- // Test for related, groupId / artifactId / version must match.
- if ( artifact.getGroupId().equals( reference.getGroupId() )
- && artifact.getArtifactId().equals( reference.getArtifactId() )
- && artifact.getVersion().equals( reference.getVersion() ) )
+ try
+ {
+ ArtifactReference artifact = toArtifactReference( relativePath );
+
+ // Test for related, groupId / artifactId / version must match.
+ if ( artifact.getGroupId().equals( reference.getGroupId() )
+ && artifact.getArtifactId().equals( reference.getArtifactId() )
+ && artifact.getVersion().equals( reference.getVersion() ) )
+ {
+ foundArtifacts.add( artifact );
+ }
+ }
+ catch ( LayoutException e )
{
- foundArtifacts.add( artifact );
+ log.debug( "Not processing file that is not an artifact: " + e.getMessage() );
}
}
}
@@ -209,7 +216,7 @@ public class ManagedDefaultRepositoryContent
}
public Set<String> getVersions( VersionedReference reference )
- throws ContentNotFoundException, LayoutException
+ throws ContentNotFoundException
{
String path = toMetadataPath( reference );
@@ -255,9 +262,16 @@ public class ManagedDefaultRepositoryContent
if ( filetypes.matchesArtifactPattern( relativePath ) )
{
- ArtifactReference artifact = toArtifactReference( relativePath );
-
- foundVersions.add( artifact.getVersion() );
+ try
+ {
+ ArtifactReference artifact = toArtifactReference( relativePath );
+
+ foundVersions.add( artifact.getVersion() );
+ }
+ catch ( LayoutException e )
+ {
+ log.debug( "Not processing file that is not an artifact: " + e.getMessage() );
+ }
}
}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
index c6237bb0f..ba98e445e 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
@@ -151,7 +151,7 @@ public class ManagedLegacyRepositoryContent
}
public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
- throws ContentNotFoundException, LayoutException
+ throws ContentNotFoundException
{
File artifactFile = toFile( reference );
File repoDir = artifactFile.getParentFile();