From: Brett Porter Date: Tue, 8 Apr 2008 04:34:36 +0000 (+0000) Subject: guard against incorrect generation X-Git-Tag: archiva-r676265~207 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=80a96f560c65a8fe3b8584842f54f6fd9dc6d8c1;p=archiva.git guard against incorrect generation git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@645761 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java index f748cb36d..6102c333d 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java @@ -103,6 +103,8 @@ public class DependencyTreeGeneratorConsumer private Field processedProjectCacheField; + private List includes = Collections.singletonList( "**/*.pom" ); + public String getDescription() { return "Generate dependency tree metadata for tracking changes across algorithms"; @@ -163,7 +165,7 @@ public class DependencyTreeGeneratorConsumer public List getIncludes() { - return Collections.singletonList( "**/*.pom" ); + return includes; } public void processFile( String path ) @@ -220,7 +222,13 @@ public class DependencyTreeGeneratorConsumer artifactFactory.createProjectArtifact( project.getGroupId(), project.getArtifactId(), 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(); writer = new FileWriter( generatedFile ); OutputFormat format = OutputFormat.createPrettyPrint(); @@ -315,4 +323,9 @@ public class DependencyTreeGeneratorConsumer return true; } } + + public void setIncludes( List includes ) + { + this.includes = includes; + } }