You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2007/08/26 16:29:18 UTC

svn commit: r569819 - /maven/sandbox/trunk/doxia/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/LinkCheck.java

Author: ltheussl
Date: Sun Aug 26 07:29:17 2007
New Revision: 569819

URL: http://svn.apache.org/viewvc?rev=569819&view=rev
Log:
Don't throw Exception in main method. Move some logs around.

Modified:
    maven/sandbox/trunk/doxia/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/LinkCheck.java

Modified: maven/sandbox/trunk/doxia/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/LinkCheck.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/LinkCheck.java?rev=569819&r1=569818&r2=569819&view=diff
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/LinkCheck.java (original)
+++ maven/sandbox/trunk/doxia/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/LinkCheck.java Sun Aug 26 07:29:17 2007
@@ -295,6 +295,24 @@
      */
     public void findFiles( List allFiles, File base )
     {
+        LOG.debug( "Locating all files to be checked..." );
+
+        findAllFiles( allFiles, base );
+
+        LOG.debug( "Located all files to be checked." );
+
+        LOG.info( "Found " + allFiles.size() + " files to check." );
+    }
+
+    /**
+     * Recurses through the given base directory and adds
+     * files to the given list that pass through the current filter.
+     *
+     * @param allFiles the list to fill
+     * @param base the base directory to traverse.
+     */
+    private void findAllFiles( List allFiles, File base )
+    {
         File[] f = base.listFiles( CUSTOM_FF );
 
         if ( f != null )
@@ -306,7 +324,7 @@
 
                 if ( file.isDirectory() )
                 {
-                    findFiles( allFiles, file );
+                    findAllFiles( allFiles, file );
                 }
                 else
                 {
@@ -330,12 +348,11 @@
         f = null;
     }
 
+
     /**
      * Execute task.
-     *
-     * @throws IOException if there are problems
      */
-    public void doExecute() throws IOException
+    public void doExecute()
     {
         if ( this.output == null )
         {
@@ -352,14 +369,8 @@
 
         List files = new LinkedList();
 
-        LOG.debug( "Locating all files to be checked..." );
-
         findFiles( files, this.basedir );
 
-        LOG.debug( "Located all files to be checked." );
-
-        LOG.info( "Found " + files.size() + " files to check." );
-
         displayMemoryConsumption();
 
         LOG.info( "Begin to check links in files..." );
@@ -389,7 +400,14 @@
 
         displayMemoryConsumption();
 
-        createDocument();
+        try
+        {
+            createDocument();
+        }
+        catch ( FileNotFoundException e )
+        {
+            LOG.error( "Could not write to output file, results will be lost!", e );
+        }
 
         validator.saveCache( this.cache );