]> source.dussan.org Git - archiva.git/commitdiff
guard against incorrect generation
authorBrett Porter <brett@apache.org>
Tue, 8 Apr 2008 04:34:36 +0000 (04:34 +0000)
committerBrett Porter <brett@apache.org>
Tue, 8 Apr 2008 04:34:36 +0000 (04:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@645761 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java

index f748cb36db90af53f500f947a88701321dc0cd07..6102c333d0f60f38039d38f0182c3a26e90cb1de 100644 (file)
@@ -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;
+    }
 }