You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/03/04 13:28:12 UTC

svn commit: r633446 - in /maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc: AbstractJavadocMojo.java JavadocUtil.java

Author: vsiveton
Date: Tue Mar  4 04:28:11 2008
New Revision: 633446

URL: http://svn.apache.org/viewvc?rev=633446&view=rev
Log:
o removed duplicate artifacts in the taglet path

Modified:
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=633446&r1=633445&r2=633446&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java Tue Mar  4 04:28:11 2008
@@ -1695,7 +1695,7 @@
             }
         }
 
-        sourcePaths = JavadocUtil.pruneSourceDirs( sourcePaths );
+        sourcePaths = JavadocUtil.pruneDirs( sourcePaths );
         return sourcePaths;
     }
 
@@ -2148,37 +2148,36 @@
         }
         else if ( taglets != null )
         {
+            List tagletsPath = new ArrayList();
             for ( int i = 0; i < taglets.length; i++ )
             {
                 Taglet current = taglets[i];
-                if ( current != null )
+
+                if ( current == null )
                 {
-                    boolean separated = false;
-                    if ( current.getTagletArtifact() != null )
-                    {
-                        path.append( getArtifactAbsolutePath( current.getTagletArtifact() ) );
-                        separated = true;
-                    }
-                    else if ( ( current.getTagletArtifact() != null )
-                        && ( StringUtils.isNotEmpty( current.getTagletArtifact().getGroupId() ) )
-                        && ( StringUtils.isNotEmpty( current.getTagletArtifact().getArtifactId() ) )
-                        && ( StringUtils.isNotEmpty( current.getTagletArtifact().getVersion() ) ) )
-                    {
-                        path.append( getArtifactAbsolutePath( current.getTagletArtifact() ) );
-                        separated = true;
-                    }
-                    else if ( StringUtils.isNotEmpty( current.getTagletpath() ) )
-                    {
-                        path.append( current.getTagletpath() );
-                        separated = true;
-                    }
+                    continue;
+                }
 
-                    if ( separated && ( i < taglets.length - 1 ) )
-                    {
-                        path.append( File.pathSeparator );
-                    }
+                if ( current.getTagletArtifact() != null )
+                {
+                    tagletsPath.add( getArtifactAbsolutePath( current.getTagletArtifact() ) );
+                }
+                else if ( ( current.getTagletArtifact() != null )
+                    && ( StringUtils.isNotEmpty( current.getTagletArtifact().getGroupId() ) )
+                    && ( StringUtils.isNotEmpty( current.getTagletArtifact().getArtifactId() ) )
+                    && ( StringUtils.isNotEmpty( current.getTagletArtifact().getVersion() ) ) )
+                {
+                    tagletsPath.add( getArtifactAbsolutePath( current.getTagletArtifact() ) );
+                }
+                else if ( StringUtils.isNotEmpty( current.getTagletpath() ) )
+                {
+                    tagletsPath.add( current.getTagletpath() );
                 }
             }
+
+            tagletsPath = JavadocUtil.pruneFiles( tagletsPath );
+
+            path.append( StringUtils.join( tagletsPath.iterator(), File.pathSeparator ) );
         }
         else
         {

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java?rev=633446&r1=633445&r2=633446&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java Tue Mar  4 04:28:11 2008
@@ -59,24 +59,60 @@
 public class JavadocUtil
 {
     /**
-     * Method that removes the invalid directories in the specified source directories
+     * Method that removes the invalid directories in the specified directories
      *
-     * @param sourceDirs the list of source directories that will be validated
-     * @return a List of valid source directories
+     * @param dirs the list of directories that will be validated
+     * @return a List of valid directories
      */
-    // TODO: could be better aligned with JXR, including getFiles() vs hasSources that finds java files.
-    protected static List pruneSourceDirs( List sourceDirs )
+    protected static List pruneDirs( List dirs )
     {
-        List pruned = new ArrayList( sourceDirs.size() );
-        for ( Iterator i = sourceDirs.iterator(); i.hasNext(); )
+        List pruned = new ArrayList( dirs.size() );
+        for ( Iterator i = dirs.iterator(); i.hasNext(); )
         {
             String dir = (String) i.next();
+
+            if ( dir == null )
+            {
+                continue;
+            }
+
             File directory = new File( dir );
             if ( directory.exists() && directory.isDirectory() )
             {
                 if ( !pruned.contains( dir ) )
                 {
                     pruned.add( dir );
+                }
+            }
+        }
+
+        return pruned;
+    }
+
+    /**
+     * Method that removes the invalid files in the specified files
+     *
+     * @param files the list of files that will be validated
+     * @return a List of valid files
+     */
+    protected static List pruneFiles( List files )
+    {
+        List pruned = new ArrayList( files.size() );
+        for ( Iterator i = files.iterator(); i.hasNext(); )
+        {
+            String f = (String) i.next();
+
+            if ( f == null )
+            {
+                continue;
+            }
+
+            File file = new File( f );
+            if ( file.exists() && file.isFile() )
+            {
+                if ( !pruned.contains( f ) )
+                {
+                    pruned.add( f );
                 }
             }
         }