guard against incorrect generation

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@645761 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2008-04-08 04:34:36 +00:00
parent fa4aa39725
commit 80a96f560c
1 changed files with 15 additions and 2 deletions

View File

@ -103,6 +103,8 @@ public class DependencyTreeGeneratorConsumer
private Field processedProjectCacheField; private Field processedProjectCacheField;
private List<String> includes = Collections.singletonList( "**/*.pom" );
public String getDescription() public String getDescription()
{ {
return "Generate dependency tree metadata for tracking changes across algorithms"; return "Generate dependency tree metadata for tracking changes across algorithms";
@ -163,7 +165,7 @@ public class DependencyTreeGeneratorConsumer
public List getIncludes() public List getIncludes()
{ {
return Collections.singletonList( "**/*.pom" ); return includes;
} }
public void processFile( String path ) public void processFile( String path )
@ -220,7 +222,13 @@ public class DependencyTreeGeneratorConsumer
artifactFactory.createProjectArtifact( project.getGroupId(), project.getArtifactId(), artifactFactory.createProjectArtifact( project.getGroupId(), project.getArtifactId(),
project.getVersion() ); project.getVersion() );
File generatedFile = new File( generatedRepositoryLocation, layout.pathOf( artifact ) + ".xml" ); String p = layout.pathOf( artifact );
if ( !p.equals( path ) )
{
throw new ConsumerException( "Bad path: " + p + "; should be: " + path );
}
File generatedFile = new File( generatedRepositoryLocation, p + ".xml" );
generatedFile.getParentFile().mkdirs(); generatedFile.getParentFile().mkdirs();
writer = new FileWriter( generatedFile ); writer = new FileWriter( generatedFile );
OutputFormat format = OutputFormat.createPrettyPrint(); OutputFormat format = OutputFormat.createPrettyPrint();
@ -315,4 +323,9 @@ public class DependencyTreeGeneratorConsumer
return true; return true;
} }
} }
public void setIncludes( List<String> includes )
{
this.includes = includes;
}
} }