diff --git a/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/BadMetadataReportProcessor.java b/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/BadMetadataReportProcessor.java index e1e7b8d91..a307e16f2 100644 --- a/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/BadMetadataReportProcessor.java +++ b/archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/BadMetadataReportProcessor.java @@ -263,17 +263,27 @@ public class BadMetadataReportProcessor List metadataVersions = versioning != null ? versioning.getVersions() : Collections.EMPTY_LIST; File versionsDir = new File( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( metadata ) ).getParentFile(); - List versions = FileUtils.getFileNames( versionsDir, "*/*.pom", null, false ); - for ( Iterator i = versions.iterator(); i.hasNext(); ) + + // TODO! I don't know how this condition can happen, but it was seen on the main repository. + // Avoid hard failure + if ( versionsDir.exists() ) { - File path = new File( (String) i.next() ); - String version = path.getParentFile().getName(); - if ( !metadataVersions.contains( version ) ) + List versions = FileUtils.getFileNames( versionsDir, "*/*.pom", null, false ); + for ( Iterator i = versions.iterator(); i.hasNext(); ) { - reporter.addFailure( metadata, "Artifact version " + version + " found in the repository but " + - "missing in the metadata." ); + File path = new File( (String) i.next() ); + String version = path.getParentFile().getName(); + if ( !metadataVersions.contains( version ) ) + { + reporter.addFailure( metadata, "Artifact version " + version + " found in the repository but " + + "missing in the metadata." ); + } } } + else + { + reporter.addFailure( metadata, "Metadata's directory did not exist: " + versionsDir ); + } } /**