maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r709693 - in /maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck: DefaultLinkCheck.java validation/LinkValidatorManager.java validation/OnlineHTTPLinkValidator.java
Date Sat, 01 Nov 2008 13:40:48 GMT
Author: vsiveton
Date: Sat Nov  1 06:40:46 2008
New Revision: 709693

URL: http://svn.apache.org/viewvc?rev=709693&view=rev
Log:
o improve logging calls

Modified:
    maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/DefaultLinkCheck.java
    maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/LinkValidatorManager.java
    maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/OnlineHTTPLinkValidator.java

Modified: maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/DefaultLinkCheck.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/DefaultLinkCheck.java?rev=709693&r1=709692&r2=709693&view=diff
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/DefaultLinkCheck.java
(original)
+++ maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/DefaultLinkCheck.java
Sat Nov  1 06:40:46 2008
@@ -20,7 +20,6 @@
  */
 
 import java.io.File;
-import java.io.FileWriter;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.Writer;
@@ -202,14 +201,20 @@
     {
         if ( this.basedir == null )
         {
-            LOG.error( "No base directory specified!" );
+            if ( LOG.isErrorEnabled() )
+            {
+                LOG.error( "No base directory specified!" );
+            }
 
             throw new NullPointerException( "The basedir can't be null!" );
         }
 
         if ( this.reportOutput == null )
         {
-            LOG.warn( "No output file specified! Results will not be written!" );
+            if ( LOG.isWarnEnabled() )
+            {
+                LOG.warn( "No output file specified! Results will not be written!" );
+            }
         }
 
         model = new LinkcheckModel();
@@ -223,11 +228,17 @@
 
         displayMemoryConsumption();
 
-        LOG.info( "Begin to check links in files..." );
+        if ( LOG.isInfoEnabled() )
+        {
+            LOG.info( "Begin to check links in files..." );
+        }
 
         findAndCheckFiles( this.basedir );
 
-        LOG.info( "Links checked." );
+        if ( LOG.isInfoEnabled() )
+        {
+            LOG.info( "Links checked." );
+        }
 
         displayMemoryConsumption();
 
@@ -237,8 +248,11 @@
         }
         catch ( Exception e )
         {
-            LOG.error( "Could not write to output file. Maybe try to specify an other encoding
instead of '"
-                + encoding + "'.", e );
+            if ( LOG.isErrorEnabled() )
+            {
+                LOG.error( "Could not write to output file. Maybe try to specify an other
encoding instead of '"
+                    + encoding + "'.", e );
+            }
         }
 
         validator.saveCache( this.linkCheckCache );
@@ -443,7 +457,6 @@
 
                         if ( Arrays.binarySearch( getExcludedPages(), diff ) >= 0 )
                         {
-
                             if ( LOG.isDebugEnabled() )
                             {
                                 LOG.debug( " Ignored analysis of " + file );
@@ -470,7 +483,10 @@
 
                     if ( model.getFiles().size() % 100 == 0 )
                     {
-                        LOG.info( "Found " + model.getFiles().size() + " files so far." );
+                        if ( LOG.isInfoEnabled() )
+                        {
+                            LOG.info( "Found " + model.getFiles().size() + " files so far."
);
+                        }
                     }
                 }
             }

Modified: maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/LinkValidatorManager.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/LinkValidatorManager.java?rev=709693&r1=709692&r2=709693&view=diff
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/LinkValidatorManager.java
(original)
+++ maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/LinkValidatorManager.java
Sat Nov  1 06:40:46 2008
@@ -176,7 +176,10 @@
 
         lvr = null;
 
-        LOG.error( "Unable to validate link : " + lvi.getLink() );
+        if ( LOG.isErrorEnabled() )
+        {
+            LOG.error( "Unable to validate link : " + lvi.getLink() );
+        }
 
         return new LinkValidationResult( LinkcheckFileResult.UNKNOWN_LEVEL, false, "No validator
found for this link" );
     }
@@ -191,13 +194,19 @@
     {
         if ( cacheFile == null )
         {
-            LOG.debug( "No cache file specified! Ignoring request to load." );
+            if ( LOG.isDebugEnabled() )
+            {
+                LOG.debug( "No cache file specified! Ignoring request to load." );
+            }
             return;
         }
 
         if ( !cacheFile.exists() )
         {
-            LOG.debug( "Specified cache file does not exist! Ignoring request to load." );
+            if ( LOG.isDebugEnabled() )
+            {
+                LOG.debug( "Specified cache file does not exist! Ignoring request to load."
);
+            }
             return;
         }
 
@@ -216,15 +225,24 @@
         }
         catch ( InvalidClassException e )
         {
-            LOG.warn( "Your cache is incompatible with this version of linkcheck. It will
be recreated." );
+            if ( LOG.isWarnEnabled() )
+            {
+                LOG.warn( "Your cache is incompatible with this version of linkcheck. It
will be recreated." );
+            }
         }
         catch ( ClassNotFoundException e )
         {
-            LOG.error( "Unable to load the cache: " + cacheFile.getAbsolutePath(), e );
+            if ( LOG.isErrorEnabled() )
+            {
+                LOG.error( "Unable to load the cache: " + cacheFile.getAbsolutePath(), e
);
+            }
         }
         catch ( IOException t )
         {
-            LOG.error( "Unable to load the cache: " + cacheFile.getAbsolutePath(), t );
+            if ( LOG.isErrorEnabled() )
+            {
+                LOG.error( "Unable to load the cache: " + cacheFile.getAbsolutePath(), t
);
+            }
         }
         finally
         {
@@ -242,7 +260,10 @@
     {
         if ( cacheFile == null )
         {
-            LOG.warn( "No cache file specified! Ignoring request to store results." );
+            if ( LOG.isWarnEnabled() )
+            {
+                LOG.warn( "No cache file specified! Ignoring request to store results." );
+            }
             return;
         }
 
@@ -286,7 +307,10 @@
         }
         catch ( IOException e )
         {
-            LOG.error( "Unable to save the cache: " + cacheFile.getAbsolutePath(), e );
+            if ( LOG.isErrorEnabled() )
+            {
+                LOG.error( "Unable to save the cache: " + cacheFile.getAbsolutePath(), e
);
+            }
         }
         finally
         {

Modified: maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/OnlineHTTPLinkValidator.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/OnlineHTTPLinkValidator.java?rev=709693&r1=709692&r2=709693&view=diff
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/OnlineHTTPLinkValidator.java
(original)
+++ maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/validation/OnlineHTTPLinkValidator.java
Sat Nov  1 06:40:46 2008
@@ -224,7 +224,10 @@
     /** Initialize the HttpClient. */
     private void initHttpClient()
     {
-        LOG.debug( "A new HttpClient instance is needed ..." );
+        if ( LOG.isDebugEnabled() )
+        {
+            LOG.debug( "A new HttpClient instance is needed ..." );
+        }
 
         // Some web servers don't allow the default user-agent sent by httpClient
         System.setProperty( "httpclient.useragent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.0)" );
@@ -271,14 +274,20 @@
         }
         else
         {
-            LOG.debug( "Not using a proxy" );
+            if ( LOG.isDebugEnabled() )
+            {
+                LOG.debug( "Not using a proxy" );
+            }
         }
 
         this.cl.setHostConfiguration( hc );
 
         this.cl.setState( state );
 
-        LOG.debug( "New HttpClient instance created." );
+        if ( LOG.isDebugEnabled() )
+        {
+            LOG.debug( "New HttpClient instance created." );
+        }
     }
 
     /**
@@ -309,7 +318,10 @@
         }
         else
         {
-            LOG.error( "Unsupported method: " + this.http.getMethod() + ", using 'get'."
);
+            if ( LOG.isErrorEnabled() )
+            {
+                LOG.error( "Unsupported method: " + this.http.getMethod() + ", using 'get'."
);
+            }
             hm = new GetMethod( link );
         }
 
@@ -327,7 +339,10 @@
 
             if ( sl == null )
             {
-                LOG.error( "Unknown error validating link : " + link );
+                if ( LOG.isErrorEnabled() )
+                {
+                    LOG.error( "Unknown error validating link : " + link );
+                }
                 return null;
             }
 
@@ -339,7 +354,10 @@
 
                 if ( locationHeader == null )
                 {
-                    LOG.error( "Site sent redirect, but did not set Location header" );
+                    if ( LOG.isErrorEnabled() )
+                    {
+                        LOG.error( "Site sent redirect, but did not set Location header"
);
+                    }
                     return hm;
                 }
 



Mime
View raw message