diff options
author | Brett Porter <brett@apache.org> | 2008-04-08 04:34:36 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2008-04-08 04:34:36 +0000 |
commit | 80a96f560c65a8fe3b8584842f54f6fd9dc6d8c1 (patch) | |
tree | 69622f26939b70d05061e3daaab554107a27fac5 /archiva-modules | |
parent | fa4aa397259b5e9a4037c71bdc490d7fb97ec529 (diff) | |
download | archiva-80a96f560c65a8fe3b8584842f54f6fd9dc6d8c1.tar.gz archiva-80a96f560c65a8fe3b8584842f54f6fd9dc6d8c1.zip |
guard against incorrect generation
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@645761 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r-- | archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java | 17 |
1 files changed, 15 insertions, 2 deletions
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<String> 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<String> includes ) + { + this.includes = includes; + } } |