Author: hboutemy
Date: Sun Jun 19 22:21:21 2011
New Revision: 1137460

URL: http://svn.apache.org/viewvc?rev=1137460&view=rev
Log:
[JXR-59] speed up AbstractJxrReport.hasSources()

Modified:
    
maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java

Modified: 
maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
URL: 
http://svn.apache.org/viewvc/maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java?rev=1137460&r1=1137459&r2=1137460&view=diff
==============================================================================
--- 
maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
 (original)
+++ 
maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
 Sun Jun 19 22:21:21 2011
@@ -226,28 +226,30 @@ public abstract class AbstractJxrReport
      */
     private boolean hasSources( File dir )
     {
-        boolean found = false;
         if ( dir.exists() && dir.isDirectory() )
         {
             File[] files = dir.listFiles();
-            for ( int i = 0; i < files.length && !found; i++ )
+            for ( int i = 0; i < files.length; i++ )
             {
                 File currentFile = files[i];
-                if ( currentFile.isFile() && currentFile.getName().endsWith( 
".java" ) )
+                if ( currentFile.isFile() )
                 {
-                    found = true;
+                    if ( currentFile.getName().endsWith( ".java" ) )
+                    {
+                        return true;
+                    }
                 }
-                else if ( currentFile.isDirectory() )
+                else
                 {
-                    boolean hasSources = hasSources( currentFile );
-                    if ( hasSources )
+                    if ( Character.isJavaIdentifierStart( 
currentFile.getName().charAt( 0 ) ) // avoid .svn directory
+                        && hasSources( currentFile ) )
                     {
-                        found = true;
+                        return true;
                     }
                 }
             }
         }
-        return found;
+        return false;
     }
 
     /**


Reply via email to