archiva-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: svn commit: r480817 - in /maven/archiva/trunk: archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/ archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/ archiva-reports-standard/src/test/java/org/apache/maven/arc...
Date Thu, 30 Nov 2006 03:49:45 GMT
All of these are meant to indicate programming errors - the RT  
exceptions should be guarded by checking the validity of the POM used  
to create the artifacts. As for the illegalstateexception - how is  
the reports module getting handed a file that doesn't exist to report  
on?

- Brett

On 30/11/2006, at 2:32 PM, joakime@apache.org wrote:

> Author: joakime
> Date: Wed Nov 29 19:32:08 2006
> New Revision: 480817
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=480817
> Log:
> * Correcting LocationArtifactReportProcessor to not throw  
> IllegalStateException as it halts the discovery and indexing.
> * Catching InvalidArtifactRTException in DefaultReportExecutor to  
> allow discovery and indexing to proceed to next artifact unhindered.
> * Catching InvalidArtifactRTException in  
> StandardArtifactIndexRecordFactory to allow discovery and indexeing  
> to proceed to next artifact unhindered.
>
>
> Modified:
>     maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/ 
> maven/archiva/indexer/record/StandardArtifactIndexRecordFactory.java
>     maven/archiva/trunk/archiva-reports-standard/src/main/java/org/ 
> apache/maven/archiva/reporting/DefaultReportExecutor.java
>     maven/archiva/trunk/archiva-reports-standard/src/main/java/org/ 
> apache/maven/archiva/reporting/LocationArtifactReportProcessor.java
>     maven/archiva/trunk/archiva-reports-standard/src/test/java/org/ 
> apache/maven/archiva/reporting/ 
> LocationArtifactReportProcessorTest.java
>
> Modified: maven/archiva/trunk/archiva-indexer/src/main/java/org/ 
> apache/maven/archiva/indexer/record/ 
> StandardArtifactIndexRecordFactory.java
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva- 
> indexer/src/main/java/org/apache/maven/archiva/indexer/record/ 
> StandardArtifactIndexRecordFactory.java? 
> view=diff&rev=480817&r1=480816&r2=480817
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/ 
> maven/archiva/indexer/record/ 
> StandardArtifactIndexRecordFactory.java (original)
> +++ maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/ 
> maven/archiva/indexer/record/ 
> StandardArtifactIndexRecordFactory.java Wed Nov 29 19:32:08 2006
> @@ -18,6 +18,7 @@
>
>  import org.apache.maven.archiva.indexer.RepositoryIndexException;
>  import org.apache.maven.artifact.Artifact;
> +import org.apache.maven.artifact.InvalidArtifactRTException;
>  import org.apache.maven.artifact.factory.ArtifactFactory;
>  import org.apache.maven.artifact.repository.ArtifactRepository;
>  import org.apache.maven.model.Dependency;
> @@ -251,8 +252,17 @@
>      {
>          // TODO: this can create a -SNAPSHOT.pom when it didn't  
> exist and a timestamped one did. This is harmless, but should be  
> avoided
>          // TODO: will this pollute with local repo metadata?
> -        MavenProject project = projectBuilder.buildFromRepository 
> ( artifact, Collections.EMPTY_LIST, repository );
> -        return project.getModel();
> +
> +        try
> +        {
> +            MavenProject project =  
> projectBuilder.buildFromRepository( artifact,  
> Collections.EMPTY_LIST, repository );
> +            return project.getModel();
> +        }
> +        catch ( InvalidArtifactRTException e )
> +        {
> +            throw new ProjectBuildingException( artifact.getId(),  
> "Unable to build project from invalid artifact ["
> +                + artifact + "]", e );
> +        }
>      }
>
>      private void populateArchiveEntries( List files,  
> StandardArtifactIndexRecord record, File artifactFile )
>
> Modified: maven/archiva/trunk/archiva-reports-standard/src/main/ 
> java/org/apache/maven/archiva/reporting/DefaultReportExecutor.java
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva- 
> reports-standard/src/main/java/org/apache/maven/archiva/reporting/ 
> DefaultReportExecutor.java?view=diff&rev=480817&r1=480816&r2=480817
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-reports-standard/src/main/java/org/ 
> apache/maven/archiva/reporting/DefaultReportExecutor.java (original)
> +++ maven/archiva/trunk/archiva-reports-standard/src/main/java/org/ 
> apache/maven/archiva/reporting/DefaultReportExecutor.java Wed Nov  
> 29 19:32:08 2006
> @@ -21,6 +21,7 @@
>  import org.apache.maven.archiva.discoverer.MetadataDiscoverer;
>  import  
> org.apache.maven.archiva.discoverer.filter.AcceptAllMetadataFilter;
>  import org.apache.maven.artifact.Artifact;
> +import org.apache.maven.artifact.InvalidArtifactRTException;
>  import org.apache.maven.artifact.factory.ArtifactFactory;
>  import org.apache.maven.artifact.repository.ArtifactRepository;
>  import  
> org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
> @@ -115,6 +116,10 @@
>                      projectBuilder.buildFromRepository 
> ( pomArtifact, Collections.EMPTY_LIST, repository );
>
>                  model = project.getModel();
> +            }
> +            catch ( InvalidArtifactRTException e )
> +            {
> +                reporter.addWarning( artifact, null, null,  
> "Invalid artifact [" + artifact + "] : " + e );
>              }
>              catch ( ProjectBuildingException e )
>              {
>
> Modified: maven/archiva/trunk/archiva-reports-standard/src/main/ 
> java/org/apache/maven/archiva/reporting/ 
> LocationArtifactReportProcessor.java
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva- 
> reports-standard/src/main/java/org/apache/maven/archiva/reporting/ 
> LocationArtifactReportProcessor.java? 
> view=diff&rev=480817&r1=480816&r2=480817
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-reports-standard/src/main/java/org/ 
> apache/maven/archiva/reporting/LocationArtifactReportProcessor.java  
> (original)
> +++ maven/archiva/trunk/archiva-reports-standard/src/main/java/org/ 
> apache/maven/archiva/reporting/LocationArtifactReportProcessor.java  
> Wed Nov 29 19:32:08 2006
> @@ -113,7 +113,7 @@
>              }
>          }
>
> -        //get the location of the artifact itself
> +        // get the location of the artifact itself
>          File file = new File( repository.getBasedir(),  
> artifactPath );
>
>          if ( file.exists() )
> @@ -140,7 +140,7 @@
>          }
>          else
>          {
> -            throw new IllegalStateException( "Couldn't find  
> artifact " + file );
> +            addFailure( reporter, artifact, "missing-artifact",  
> "The artifact file [" + file + "] cannot be found for metadata." );
>          }
>      }
>
>
> Modified: maven/archiva/trunk/archiva-reports-standard/src/test/ 
> java/org/apache/maven/archiva/reporting/ 
> LocationArtifactReportProcessorTest.java
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva- 
> reports-standard/src/test/java/org/apache/maven/archiva/reporting/ 
> LocationArtifactReportProcessorTest.java? 
> view=diff&rev=480817&r1=480816&r2=480817
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-reports-standard/src/test/java/org/ 
> apache/maven/archiva/reporting/ 
> LocationArtifactReportProcessorTest.java (original)
> +++ maven/archiva/trunk/archiva-reports-standard/src/test/java/org/ 
> apache/maven/archiva/reporting/ 
> LocationArtifactReportProcessorTest.java Wed Nov 29 19:32:08 2006
> @@ -157,16 +157,10 @@
>          Artifact artifact = createArtifact( "groupId",  
> "artifactId", "1.0-alpha-2" );
>          Artifact pomArtifact = createArtifact( "groupId",  
> "artifactId", "1.0-alpha-2", "pom" );
>
> -        try
> -        {
> -            Model model = readPom( repository.pathOf 
> ( pomArtifact ) );
> -            artifactReportProcessor.processArtifact( artifact,  
> model, reportDatabase );
> -            fail( "Should not have passed the artifact" );
> -        }
> -        catch ( IllegalStateException e )
> -        {
> -            // correct!
> -        }
> +        Model model = readPom( repository.pathOf( pomArtifact ) );
> +        artifactReportProcessor.processArtifact( artifact, model,  
> reportDatabase );
> +
> +        assertEquals( 1, reportDatabase.getNumFailures() );
>      }
>
>      /**
>

Mime
View raw message