maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherit...@apache.org
Subject svn commit: r522369 - in /maven/maven-1: plugins-sandbox/trunk/modello/src/main/org/apache/maven/plugins/modello/ plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/ plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/val...
Date Sun, 25 Mar 2007 22:50:06 GMT
Author: aheritier
Date: Sun Mar 25 15:50:05 2007
New Revision: 522369

URL: http://svn.apache.org/viewvc?view=rev&rev=522369
Log:
Cleanup / format code

Modified:
    maven/maven-1/plugins-sandbox/trunk/modello/src/main/org/apache/maven/plugins/modello/ModelloCliWrapper.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/FileToCheck.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheckResult.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkMatcher.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/FileLinkValidator.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidator.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationItem.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationResult.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidator.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidatorManager.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/MailtoLinkValidator.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OfflineHTTPLinkValidator.java
    maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java
    maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/LinkCheckTest.java
    maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java

Modified: maven/maven-1/plugins-sandbox/trunk/modello/src/main/org/apache/maven/plugins/modello/ModelloCliWrapper.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins-sandbox/trunk/modello/src/main/org/apache/maven/plugins/modello/ModelloCliWrapper.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/modello/src/main/org/apache/maven/plugins/modello/ModelloCliWrapper.java (original)
+++ maven/maven-1/plugins-sandbox/trunk/modello/src/main/org/apache/maven/plugins/modello/ModelloCliWrapper.java Sun Mar 25 15:50:05 2007
@@ -26,16 +26,20 @@
 public class ModelloCliWrapper
 {
     private String model;
+
     private String packageWithVersion;
+
     private String version;
+
     private String type;
+
     private String targetDirectory;
 
     public void generate() throws Exception
     {
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
-        String[] args = new String[] { model, type, targetDirectory, version, packageWithVersion };
+        String[] args = new String[] { this.model, this.type, this.targetDirectory, this.version, this.packageWithVersion };
         ModelloCli.main( args );
         Thread.currentThread().setContextClassLoader( oldClassLoader );
     }

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/FileToCheck.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/FileToCheck.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/FileToCheck.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/FileToCheck.java Sun Mar 25 15:50:05 2007
@@ -17,18 +17,18 @@
  * ====================================================================
  */
 
-import java.io.File;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.maven.plugin.linkcheck.validation.LinkValidationItem;
 import org.apache.maven.plugin.linkcheck.validation.LinkValidationResult;
 import org.apache.maven.plugin.linkcheck.validation.LinkValidatorManager;
 
+import java.io.File;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
 /**
  * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
  * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a>
@@ -63,19 +63,20 @@
 
     /**
      * Returns the message.
+     * 
      * @return String
      */
     public String getMessage()
     {
-        return message;
+        return this.message;
     }
 
     public String getName()
     {
-        String fileName = fileToCheck.getAbsolutePath();
-        if ( fileName.startsWith( base ) )
+        String fileName = this.fileToCheck.getAbsolutePath();
+        if ( fileName.startsWith( this.base ) )
         {
-            fileName = fileName.substring( base.length() + 1 );
+            fileName = fileName.substring( this.base.length() + 1 );
         }
 
         fileName = fileName.replace( '\\', '/' );
@@ -84,34 +85,37 @@
 
     public List getResults()
     {
-        return links;
+        return this.links;
     }
 
     /**
      * Returns the status.
+     * 
      * @return int
      */
     public String getStatus()
     {
-        return status;
+        return this.status;
     }
 
     /**
      * Returns the successful.
+     * 
      * @return int
      */
     public int getSuccessful()
     {
-        return successful;
+        return this.successful;
     }
 
     /**
      * Returns the unsuccessful.
+     * 
      * @return int
      */
     public int getUnsuccessful()
     {
-        return unsuccessful;
+        return this.unsuccessful;
     }
 
     public FileToCheck( File baseFile, File fileToCheck )
@@ -120,13 +124,12 @@
         this.fileToCheck = fileToCheck;
     }
 
-    public void check( LinkValidatorManager lvm )
-        throws Exception
+    public void check( LinkValidatorManager lvm ) throws Exception
     {
-        successful = 0;
-        unsuccessful = 0;
-        status = STATUS_OK;
-        message = "";
+        this.successful = 0;
+        this.unsuccessful = 0;
+        this.status = STATUS_OK;
+        this.message = "";
         if ( LOG.isDebugEnabled() )
         {
             LOG.debug( "Validating " + getName() );
@@ -136,16 +139,20 @@
             final Set hrefs;
             try
             {
-                hrefs = LinkMatcher.match( fileToCheck );
+                hrefs = LinkMatcher.match( this.fileToCheck );
             }
             catch ( Throwable t )
             {
-                //We catch Throwable, because there is a chance that the domReader will throw
-                //a stack overflow exception for some files
+                // We catch Throwable, because there is a chance that the domReader will throw
+                // a stack overflow exception for some files
                 if ( LOG.isDebugEnabled() )
+                {
                     LOG.error( "Received: [" + t + "] in page [" + getName() + "]", t );
+                }
                 else
+                {
                     LOG.error( "Received: [" + t + "] in page [" + getName() + "]" );
+                }
                 LinkCheckResult lcr = new LinkCheckResult();
                 lcr.setStatus( "PARSE FAILURE" );
                 lcr.setTarget( "N/A" );
@@ -160,29 +167,30 @@
             {
                 href = (String) iter.next();
                 lcr = new LinkCheckResult();
-                lvi = new LinkValidationItem( fileToCheck, href );
+                lvi = new LinkValidationItem( this.fileToCheck, href );
                 result = lvm.validateLink( lvi );
                 lcr.setTarget( href );
                 lcr.setErrorMessage( result.getErrorMessage() );
                 switch ( result.getStatus() )
                 {
                     case LinkValidationResult.VALID:
-                        successful++;
+                        this.successful++;
                         lcr.setStatus( "valid" );
-                        addResult( lcr ); //At some point we won't want to store valid links.  The tests require that we do at present
+                        addResult( lcr ); // At some point we won't want to store valid links. The tests require that
+                        // we do at present
                         break;
                     case LinkValidationResult.UNKNOWN:
-                        unsuccessful++;
+                        this.unsuccessful++;
                         lcr.setStatus( "unknown" );
                         addResult( lcr );
                         break;
                     case LinkValidationResult.ERROR:
-                        unsuccessful++;
+                        this.unsuccessful++;
                         lcr.setStatus( "error" );
                         addResult( lcr );
                         break;
                     case LinkValidationResult.WARNING:
-                        unsuccessful++;
+                        this.unsuccessful++;
                         lcr.setStatus( "warning" );
                         addResult( lcr );
                         break;
@@ -196,8 +204,8 @@
         }
         catch ( Exception e )
         {
-            LOG.error( message );
-            throw ( e );
+            LOG.error( this.message );
+            throw e;
         }
     }
 

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java Sun Mar 25 15:50:05 2007
@@ -17,6 +17,16 @@
  * ====================================================================
  */
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.maven.jelly.MavenJellyContext;
+import org.apache.maven.plugin.linkcheck.validation.FileLinkValidator;
+import org.apache.maven.plugin.linkcheck.validation.LinkValidatorManager;
+import org.apache.maven.plugin.linkcheck.validation.MailtoLinkValidator;
+import org.apache.maven.plugin.linkcheck.validation.OfflineHTTPLinkValidator;
+import org.apache.maven.plugin.linkcheck.validation.OnlineHTTPLinkValidator;
+import org.apache.maven.project.Project;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -30,19 +40,8 @@
 import java.util.List;
 import java.util.StringTokenizer;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.maven.jelly.MavenJellyContext;
-import org.apache.maven.plugin.linkcheck.validation.FileLinkValidator;
-import org.apache.maven.plugin.linkcheck.validation.LinkValidatorManager;
-import org.apache.maven.plugin.linkcheck.validation.MailtoLinkValidator;
-import org.apache.maven.plugin.linkcheck.validation.OfflineHTTPLinkValidator;
-import org.apache.maven.plugin.linkcheck.validation.OnlineHTTPLinkValidator;
-import org.apache.maven.project.Project;
-
 /**
- * The main bean to be called whenever a set of documents should have
- * their links checked.
+ * The main bean to be called whenever a set of documents should have their links checked.
  * 
  * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
  * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
@@ -83,12 +82,12 @@
     private LinkValidatorManager lvm = null;
 
     /**
-     * Output file for xml document 
+     * Output file for xml document
      */
     private File output;
 
     /**
-     * Output encoding for the xml document 
+     * Output encoding for the xml document
      */
     private String outputEncoding;
 
@@ -96,17 +95,19 @@
 
     /**
      * Get the base directory for the change log generator.
-     *
+     * 
      * @return the base directory
      */
     public File getBasedir()
     {
-        return basedir;
+        return this.basedir;
     }
 
     /**
      * Set the base directory for the change log generator.
-     * @param base the base directory
+     * 
+     * @param base
+     *            the base directory
      */
     public void setBasedir( File base )
     {
@@ -115,16 +116,19 @@
 
     /**
      * Returns the cacheFile.
+     * 
      * @return String
      */
     public String getCache()
     {
-        return cache;
+        return this.cache;
     }
 
     /**
      * Sets the cacheFile.
-     * @param cacheFile The cacheFile to set
+     * 
+     * @param cacheFile
+     *            The cacheFile to set
      */
     public void setCache( String cache )
     {
@@ -133,17 +137,17 @@
 
     /**
      * Returns the exclude.
+     * 
      * @return String
      */
     public String getExclude()
     {
-        return exclude;
+        return this.exclude;
     }
 
     /**
-     * Sets the exclude, a string with exclude locations delimited by the space
-     * character, the comma character, the tab character, the newline character,
-     * the carriage-return character, and the form-feed character.
+     * Sets the exclude, a string with exclude locations delimited by the space character, the comma character, the tab
+     * character, the newline character, the carriage-return character, and the form-feed character.
      * 
      * @param exclude
      *            The exclude to set
@@ -158,11 +162,12 @@
      */
     public String getMethod()
     {
-        return method;
+        return this.method;
     }
 
     /**
-     * @param method the method to set
+     * @param method
+     *            the method to set
      */
     public void setMethod( String method )
     {
@@ -171,60 +176,59 @@
 
     public List getFiles()
     {
-        return filesToCheck;
+        return this.filesToCheck;
     }
 
     public LinkValidatorManager getLinkValidatorManager()
     {
-        if ( lvm == null )
+        if ( this.lvm == null )
         {
-            lvm = new LinkValidatorManager();
-            if ( exclude != null )
+            this.lvm = new LinkValidatorManager();
+            if ( this.exclude != null )
             {
-                StringTokenizer st = new StringTokenizer( exclude, " ,\t\n\r\f" );
+                StringTokenizer st = new StringTokenizer( this.exclude, " ,\t\n\r\f" );
                 String[] tokens = new String[st.countTokens()];
                 for ( int i = 0; i < tokens.length; i++ )
                 {
                     tokens[i] = st.nextToken();
                 }
-                lvm.setExcludes( tokens );
+                this.lvm.setExcludes( tokens );
                 tokens = null;
                 st = null;
             }
-            lvm.addLinkValidator( new FileLinkValidator() );
+            this.lvm.addLinkValidator( new FileLinkValidator() );
             // Project is only null in test cases
             if ( getProject() != null )
             {
                 MavenJellyContext ctx = ( (Project) getProject() ).getContext();
                 if ( ctx.getOnline().booleanValue() )
                 {
-                    lvm
-                        .addLinkValidator( new OnlineHTTPLinkValidator(
-                                                                        getMethod(),
-                                                                        (String) ctx.getVariable( MAVEN_PROXY_HOST ),
-                                                                        (String) ctx.getVariable( MAVEN_PROXY_PORT ),
-                                                                        (String) ctx.getVariable( MAVEN_PROXY_USERNAME ),
-                                                                        (String) ctx.getVariable( MAVEN_PROXY_PASSWORD ),
-                                                                        (String) ctx
-                                                                            .getVariable( MAVEN_PROXY_NTLM_HOST ),
-                                                                        (String) ctx
-                                                                            .getVariable( MAVEN_PROXY_NTLM_DOMAIN ) ) );
+                    this.lvm.addLinkValidator( new OnlineHTTPLinkValidator(
+                                                                       getMethod(),
+                                                                       (String) ctx.getVariable( MAVEN_PROXY_HOST ),
+                                                                       (String) ctx.getVariable( MAVEN_PROXY_PORT ),
+                                                                       (String) ctx.getVariable( MAVEN_PROXY_USERNAME ),
+                                                                       (String) ctx.getVariable( MAVEN_PROXY_PASSWORD ),
+                                                                       (String) ctx.getVariable( MAVEN_PROXY_NTLM_HOST ),
+                                                                       (String) ctx.getVariable( MAVEN_PROXY_NTLM_DOMAIN ) ) );
                 }
                 else
                 {
-                    lvm.addLinkValidator( new OfflineHTTPLinkValidator() );
+                    this.lvm.addLinkValidator( new OfflineHTTPLinkValidator() );
 
                 }
                 ctx = null;
             }
-            lvm.addLinkValidator( new MailtoLinkValidator() );
+            this.lvm.addLinkValidator( new MailtoLinkValidator() );
         }
-        return lvm;
+        return this.lvm;
     }
 
     /**
      * Set the output file for the log.
-     * @param output the output file
+     * 
+     * @param output
+     *            the output file
      */
     public void setOutput( File output )
     {
@@ -233,16 +237,19 @@
 
     /**
      * Returns the outputEncoding.
+     * 
      * @return String
      */
     public String getOutputEncoding()
     {
-        return outputEncoding;
+        return this.outputEncoding;
     }
 
     /**
      * Sets the outputEncoding.
-     * @param outputEncoding The outputEncoding to set
+     * 
+     * @param outputEncoding
+     *            The outputEncoding to set
      */
     public void setOutputEncoding( String outputEncoding )
     {
@@ -254,12 +261,14 @@
      */
     public Object getProject()
     {
-        return project;
+        return this.project;
     }
 
     /**
      * Sets the project.
-     * @param project The project to set
+     * 
+     * @param project
+     *            The project to set
      */
     public void setProject( Object project )
     {
@@ -285,7 +294,7 @@
                     {
                         LOG.debug( " File - " + file );
                     }
-                    allFiles.add( new FileToCheck( basedir, file ) );
+                    allFiles.add( new FileToCheck( this.basedir, file ) );
                     if ( allFiles.size() % 100 == 0 )
                     {
                         LOG.info( "Found " + allFiles.size() + " files so far." );
@@ -299,16 +308,18 @@
 
     /**
      * Execute task.
-     * @throws FileNotFoundException if {@link ChangeLog#base} doesn't exist
-     * @throws IOException if there are problems running CVS
-     * @throws UnsupportedEncodingException if the underlying platform doesn't
-     *      support ISO-8859-1 encoding
+     * 
+     * @throws FileNotFoundException
+     *             if {@link ChangeLog#base} doesn't exist
+     * @throws IOException
+     *             if there are problems running CVS
+     * @throws UnsupportedEncodingException
+     *             if the underlying platform doesn't support ISO-8859-1 encoding
      */
 
-    public void doExecute()
-        throws FileNotFoundException, IOException, UnsupportedEncodingException
+    public void doExecute() throws FileNotFoundException, IOException, UnsupportedEncodingException
     {
-        if ( output == null )
+        if ( this.output == null )
         {
             throw new NullPointerException( "output must be set" );
         }
@@ -317,11 +328,11 @@
             displayMemoryConsumption();
         }
         LinkValidatorManager validator = getLinkValidatorManager();
-        filesToCheck = new LinkedList();
-        validator.loadCache( cache );
+        this.filesToCheck = new LinkedList();
+        validator.loadCache( this.cache );
         List files = new LinkedList();
         LOG.debug( "Locating all files to be checked..." );
-        findFiles( files, basedir );
+        findFiles( files, this.basedir );
         LOG.debug( "Located all files to be checked." );
         LOG.info( "Found " + files.size() + " files to check." );
         displayMemoryConsumption();
@@ -333,7 +344,7 @@
             flc = (FileToCheck) fileIter.next();
             try
             {
-                filesToCheck.add( flc );
+                this.filesToCheck.add( flc );
                 flc.check( validator );
             }
             catch ( Exception e )
@@ -345,7 +356,7 @@
         LOG.info( "Links checked." );
         displayMemoryConsumption();
         createDocument( files );
-        validator.saveCache( cache );
+        validator.saveCache( this.cache );
         displayMemoryConsumption();
     }
 
@@ -369,28 +380,29 @@
         if ( LOG.isDebugEnabled() )
         {
             Runtime r = Runtime.getRuntime();
-            LOG.debug( "Memory: " + ( ( r.totalMemory() - r.freeMemory() ) / MEG ) + "M/" + ( r.totalMemory() / MEG )
-                + "M" );
+            LOG.debug( "Memory: " + ( r.totalMemory() - r.freeMemory() ) / MEG + "M/" + r.totalMemory() / MEG
+                            + "M" );
         }
     }
 
     /**
      * Create the XML document from the currently available details
-     * @throws FileNotFoundException when the output file previously provided
-     *      does not exist
-     * @throws UnsupportedEncodingException when the platform doesn't support
-     *      ISO-8859-1 encoding
+     * 
+     * @throws FileNotFoundException
+     *             when the output file previously provided does not exist
+     * @throws UnsupportedEncodingException
+     *             when the platform doesn't support ISO-8859-1 encoding
      */
-    private void createDocument( List files )
-        throws FileNotFoundException, UnsupportedEncodingException
+    private void createDocument( List files ) throws FileNotFoundException, UnsupportedEncodingException
 
     {
-        File dir = output.getParentFile();
+        File dir = this.output.getParentFile();
         if ( dir != null )
         {
             dir.mkdirs();
         }
-        PrintWriter out = new PrintWriter( new OutputStreamWriter( new FileOutputStream( output ), getOutputEncoding() ) );
+        PrintWriter out =
+            new PrintWriter( new OutputStreamWriter( new FileOutputStream( this.output ), getOutputEncoding() ) );
         StringBuffer buffer = new StringBuffer();
         buffer.append( "<?xml version=\"1.0\" encoding=\"" ).append( getOutputEncoding() ).append( "\" ?>\n" );
         out.write( buffer.toString() );
@@ -402,8 +414,7 @@
     }
 
     /** Custom FilenameFilter used to search html files */
-    static class CustomFilenameFilter
-        implements FilenameFilter
+    static class CustomFilenameFilter implements FilenameFilter
     {
         /**
          * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
@@ -412,7 +423,9 @@
         {
             File n = new File( dir, name );
             if ( n.isDirectory() )
+            {
                 return true;
+            }
             if ( name.endsWith( ".html" ) )
             {
                 return true;

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheckResult.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheckResult.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheckResult.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheckResult.java Sun Mar 25 15:50:05 2007
@@ -21,6 +21,7 @@
 
 /**
  * An class containing the results of a single check of a link.
+ * 
  * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
  * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a>
  * @version $Id$
@@ -35,16 +36,19 @@
 
     /**
      * Returns the status.
+     * 
      * @return String
      */
     public String getStatus()
     {
-        return status;
+        return this.status;
     }
 
     /**
      * Sets the status.
-     * @param status The status to set
+     * 
+     * @param status
+     *            The status to set
      */
     public void setStatus( String status )
     {
@@ -53,16 +57,19 @@
 
     /**
      * Returns the target.
+     * 
      * @return String
      */
     public String getTarget()
     {
-        return target;
+        return this.target;
     }
 
     /**
      * Sets the target.
-     * @param target The target to set
+     * 
+     * @param target
+     *            The target to set
      */
     public void setTarget( String target )
     {
@@ -74,11 +81,12 @@
      */
     public String getErrorMessage()
     {
-        return errorMessage;
+        return this.errorMessage;
     }
 
     /**
-     * @param errorMessage The errorMessage to set.
+     * @param errorMessage
+     *            The errorMessage to set.
      */
     public void setErrorMessage( String errorMessage )
     {
@@ -87,6 +95,7 @@
 
     /**
      * Creates an XML representation of this link check result
+     * 
      * @return xml fragment representation of this result
      */
     public String toXML()

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkMatcher.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkMatcher.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkMatcher.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkMatcher.java Sun Mar 25 15:50:05 2007
@@ -27,8 +27,7 @@
 import java.util.regex.Pattern;
 
 /**
- * Link matcher. Reads the contents of a file and tries to match the following:
- * <code>
+ * Link matcher. Reads the contents of a file and tries to match the following: <code>
  * <a href=""....
  * <link href=""....
  * <img src=""....
@@ -43,13 +42,12 @@
     /**
      * Regexp for link matching.
      */
-    private final static Pattern p = Pattern
-        .compile( "<(?>link|a|img|script)[^>]*?(?>href|src)\\s*?=\\s*?[\\\"'](.*?)[\\\"'][^>]*?",
-                  Pattern.CASE_INSENSITIVE );
+    private final static Pattern p =
+        Pattern.compile( "<(?>link|a|img|script)[^>]*?(?>href|src)\\s*?=\\s*?[\\\"'](.*?)[\\\"'][^>]*?",
+                         Pattern.CASE_INSENSITIVE );
 
     /**
-     * No need to create a new object each time a file is processed. Just clear
-     * it.
+     * No need to create a new object each time a file is processed. Just clear it.
      */
     private final static Set linkList = new TreeSet();
 
@@ -65,8 +63,7 @@
      * @return a StringBuffer with file's contents.
      * @throws IOException
      */
-    private static StringBuffer fileToStringBuffer( File file )
-        throws IOException
+    private static StringBuffer fileToStringBuffer( File file ) throws IOException
     {
         BufferedReader reader = null;
         final StringBuffer pageBuffer = new StringBuffer();
@@ -94,8 +91,7 @@
      * @return a set with all links to check
      * @throws IOException
      */
-    static Set match( File file )
-        throws IOException
+    static Set match( File file ) throws IOException
     {
         linkList.clear();
         final Matcher m = p.matcher( fileToStringBuffer( file ) );

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/FileLinkValidator.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/FileLinkValidator.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/FileLinkValidator.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/FileLinkValidator.java Sun Mar 25 15:50:05 2007
@@ -26,8 +26,7 @@
  * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a>
  * @version $Id$
  */
-public final class FileLinkValidator
-    implements LinkValidator
+public final class FileLinkValidator implements LinkValidator
 {
     /**
      * @see org.apache.maven.plugin.linkcheck.LinkValidator#validateLink(org.apache.maven.plugin.linkcheck.LinkValidationItem)
@@ -36,9 +35,13 @@
     {
         File f = getFile( lvi );
         if ( f.exists() )
+        {
             return new LinkValidationResult( LinkValidationResult.VALID, false, "" );
+        }
         else
+        {
             return new LinkValidationResult( LinkValidationResult.ERROR, false, "doesn't exist." );
+        }
     }
 
     /**
@@ -49,7 +52,9 @@
         String link = lvi.getLink();
         // If we find an http(s) link or a mail link, it's not good
         if ( link.startsWith( "http://" ) || link.startsWith( "https://" ) || link.indexOf( '@' ) != -1 )
+        {
             return null;
+        }
         return getFile( lvi ).getAbsolutePath();
     }
 
@@ -65,19 +70,23 @@
         {
             link = link.substring( 0, link.indexOf( '#' ) );
 
-            //If the link was just #fred or similar, then the file is the file it came from
-            //XXX: Theoretically we could even validate the anchor tag?
+            // If the link was just #fred or similar, then the file is the file it came from
+            // XXX: Theoretically we could even validate the anchor tag?
             if ( link.trim().length() == 0 )
+            {
                 return lvi.getSource();
+            }
         }
         if ( link.indexOf( '?' ) != -1 )
         {
             link = link.substring( 0, link.indexOf( '?' ) );
 
-            //If the link was just ?param=something or similar, then the file is the file it came from
-            //XXX: Theoretically we could even validate the anchor tag?
+            // If the link was just ?param=something or similar, then the file is the file it came from
+            // XXX: Theoretically we could even validate the anchor tag?
             if ( link.trim().length() == 0 )
+            {
                 return lvi.getSource();
+            }
         }
         File f = new File( lvi.getSource().getParentFile(), link );
         return f;

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidator.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidator.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidator.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidator.java Sun Mar 25 15:50:05 2007
@@ -17,15 +17,14 @@
  * ====================================================================
  */
 
-
 /**
  * Checks links which are normal URLs
+ * 
  * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
  * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a>
  * @version $Id$
  */
-public abstract class HTTPLinkValidator
-    implements LinkValidator
+public abstract class HTTPLinkValidator implements LinkValidator
 {
     /**
      * @see org.apache.maven.plugin.linkcheck.LinkValidator#getResourceKey(org.apache.maven.plugin.linkcheck.LinkValidationItem)
@@ -34,10 +33,14 @@
     {
         String link = lvi.getLink();
         if ( !link.startsWith( "http://" ) && !link.startsWith( "https://" ) )
+        {
             return null;
+        }
         int hashPos = link.indexOf( "#" );
         if ( hashPos != -1 )
+        {
             link = link.substring( 0, hashPos );
+        }
         return link;
     }
 

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationItem.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationItem.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationItem.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationItem.java Sun Mar 25 15:50:05 2007
@@ -16,7 +16,7 @@
  *   limitations under the License.
  * ====================================================================
  */
- 
+
 import java.io.File;
 
 /**
@@ -24,59 +24,74 @@
  * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a>
  * @version $Id$
  */
-public class LinkValidationItem {
+public class LinkValidationItem
+{
     private final File source;
+
     private final String link;
-    
-    public LinkValidationItem(File source, String link) {
-        if (source == null) {
-            throw new NullPointerException("source can't be null");
+
+    public LinkValidationItem( File source, String link )
+    {
+        if ( source == null )
+        {
+            throw new NullPointerException( "source can't be null" );
         }
-        
-        if (link == null) {
-            throw new NullPointerException("link can't be null");
+
+        if ( link == null )
+        {
+            throw new NullPointerException( "link can't be null" );
         }
-        
+
         this.source = source;
         this.link = link;
     }
 
     /**
      * Returns the link.
+     * 
      * @return String
      */
-    public String getLink() {
-        return link;
+    public String getLink()
+    {
+        return this.link;
     }
 
     /**
      * Returns the source.
+     * 
      * @return File
      */
-    public File getSource() {
-        return source;
+    public File getSource()
+    {
+        return this.source;
     }
 
     /**
      * @see java.lang.Object#equals(java.lang.Object)
      */
-    public boolean equals(Object obj) {
+    public boolean equals( Object obj )
+    {
         LinkValidationItem lvi = (LinkValidationItem) obj;
-        
-        if (!lvi.link.equals(link))
+
+        if ( !lvi.link.equals( this.link ) )
+        {
             return false;
-            
-        if (!lvi.source.equals(source))
+        }
+
+        if ( !lvi.source.equals( this.source ) )
+        {
             return false;
-            
+        }
+
         return true;
     }
 
     /**
      * @see java.lang.Object#hashCode()
      */
-    public int hashCode() {
-        return source.hashCode() ^ link.hashCode();
+    public int hashCode()
+    {
+        return this.source.hashCode() ^ this.link.hashCode();
     }
-    
+
 }

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationResult.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationResult.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationResult.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidationResult.java Sun Mar 25 15:50:05 2007
@@ -21,17 +21,21 @@
 
 /**
  * <p>
- *   This  class is used to return status responses from the
- *   validation handlers.  A persistent result means that it
- *   can be stored in the persistent cache and used across runs.
+ * This class is used to return status responses from the validation handlers. A persistent result means that it can be
+ * stored in the persistent cache and used across runs.
  * </p>
+ * 
  * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
  * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a>
  * @version $Id$
  */
-public class LinkValidationResult
-    implements Serializable
+public class LinkValidationResult implements Serializable
 {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -8346824125135406813L;
+
     public static final int NOTMINE = 0;
 
     public static final int ERROR = 1;
@@ -50,16 +54,17 @@
 
     public boolean isPersistent()
     {
-        return persistent;
+        return this.persistent;
     }
 
     /**
      * Returns the status.
+     * 
      * @return int
      */
     public int getStatus()
     {
-        return status;
+        return this.status;
     }
 
     /**
@@ -67,7 +72,7 @@
      */
     public String getErrorMessage()
     {
-        return errorMessage;
+        return this.errorMessage;
     }
 
     public LinkValidationResult( int status, boolean persistent, String errorMessage )
@@ -77,12 +82,14 @@
         this.errorMessage = errorMessage;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see java.lang.Object#toString()
      */
     public String toString()
     {
-        return persistent + "/" + status + "/" + errorMessage;
+        return this.persistent + "/" + this.status + "/" + this.errorMessage;
     }
 
 }

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidator.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidator.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidator.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidator.java Sun Mar 25 15:50:05 2007
@@ -27,16 +27,17 @@
 
     /**
      * If getResource(lvi) returned null, this will NOT be called.
+     * 
      * @param lvi
      * @return int
      * @throws Exception
      */
-    public LinkValidationResult validateLink( LinkValidationItem lvi )
-        throws Exception;
+    public LinkValidationResult validateLink( LinkValidationItem lvi ) throws Exception;
 
     /**
-     * The resource key is used by the cache to determine if it really needs to
-     * validate the link.  No actual validation should be done at this point.
+     * The resource key is used by the cache to determine if it really needs to validate the link. No actual validation
+     * should be done at this point.
+     * 
      * @param lvi
      * @return Object null if this validator should not be doing this work.
      * @throws Exception

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidatorManager.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidatorManager.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidatorManager.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/LinkValidatorManager.java Sun Mar 25 15:50:05 2007
@@ -17,6 +17,9 @@
  * ====================================================================
  */
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -30,9 +33,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 /**
  * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
  * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
@@ -40,10 +40,14 @@
  * @version $Id$
  */
 
-public class LinkValidatorManager
-    implements Serializable
+public class LinkValidatorManager implements Serializable
 {
     /**
+     * 
+     */
+    private static final long serialVersionUID = 2467928182206500945L;
+
+    /**
      * Log for debug output
      */
     private static Log LOG = LogFactory.getLog( LinkValidatorManager.class );
@@ -60,22 +64,25 @@
 
     public List getValidators()
     {
-        return validators;
+        return this.validators;
     }
 
     /**
      * Returns the exclude.
+     * 
      * @return String
      * @deprecated use getExcludes()
      */
     public String getExclude()
     {
-        return excludes[0];
+        return this.excludes[0];
     }
 
     /**
      * Sets the exclude.
-     * @param exclude The exclude to set
+     * 
+     * @param exclude
+     *            The exclude to set
      * @deprecated use setExcludes()
      */
     public void setExclude( String exclude )
@@ -85,16 +92,19 @@
 
     /**
      * Returns the excludes.
+     * 
      * @return String[]
      */
     public String[] getExcludes()
     {
-        return excludes;
+        return this.excludes;
     }
 
     /**
      * Sets the excludes.
-     * @param excludes The excludes to set
+     * 
+     * @param excludes
+     *            The excludes to set
      */
     public void setExcludes( String[] excludes )
     {
@@ -103,11 +113,10 @@
 
     public void addLinkValidator( LinkValidator lv )
     {
-        validators.add( lv );
+        this.validators.add( lv );
     }
 
-    public LinkValidationResult validateLink( LinkValidationItem lvi )
-        throws Exception
+    public LinkValidationResult validateLink( LinkValidationItem lvi ) throws Exception
     {
         {
             LinkValidationResult status = getCachedResult( lvi );
@@ -117,9 +126,9 @@
             }
         }
 
-        for ( int i = 0; i < excludes.length; i++ )
+        for ( int i = 0; i < this.excludes.length; i++ )
         {
-            if ( excludes[i] != null && lvi.getLink().startsWith( excludes[i] ) )
+            if ( this.excludes[i] != null && lvi.getLink().startsWith( this.excludes[i] ) )
             {
                 if ( LOG.isDebugEnabled() )
                 {
@@ -128,7 +137,7 @@
                 return new LinkValidationResult( LinkValidationResult.VALID, false, "" );
             }
         }
-        Iterator iter = validators.iterator();
+        Iterator iter = this.validators.iterator();
         LinkValidator lv;
         Object resourceKey;
         LinkValidationResult lvr;
@@ -139,7 +148,9 @@
             if ( resourceKey != null )
             {
                 if ( LOG.isDebugEnabled() )
+                {
                     LOG.debug( lv.getClass().getName() + " - Checking link " + lvi.getLink() );
+                }
                 lvr = lv.validateLink( lvi );
                 if ( lvr.getStatus() == LinkValidationResult.NOTMINE )
                 {
@@ -189,12 +200,14 @@
             while ( iter.hasNext() )
             {
                 resourceKey = iter.next();
-                if ( ( (LinkValidationResult) cache.get( resourceKey ) ).isPersistent() )
+                if ( ( (LinkValidationResult) this.cache.get( resourceKey ) ).isPersistent() )
                 {
-                    persistentCache.put( resourceKey, cache.get( resourceKey ) );
+                    persistentCache.put( resourceKey, this.cache.get( resourceKey ) );
                     if ( LOG.isDebugEnabled() )
-                        LOG.debug( "[" + resourceKey + "] with result [" + cache.get( resourceKey )
-                            + "] is stored in the cache." );
+                    {
+                        LOG.debug( "[" + resourceKey + "] with result [" + this.cache.get( resourceKey )
+                                        + "] is stored in the cache." );
+                    }
                 }
             }
             File cacheFile = new File( cacheFilename );
@@ -233,12 +246,14 @@
         {
             lv = (LinkValidator) iter.next();
             resourceKey = lv.getResourceKey( lvi );
-            if ( resourceKey != null && cache.containsKey( resourceKey ) )
+            if ( resourceKey != null && this.cache.containsKey( resourceKey ) )
             {
                 if ( LOG.isDebugEnabled() )
-                    LOG.debug( "The cache returns for [" + resourceKey + "] the result [" + cache.get( resourceKey )
-                        + "]." );
-                return (LinkValidationResult) cache.get( resourceKey );
+                {
+                    LOG.debug( "The cache returns for [" + resourceKey + "] the result [" + this.cache.get( resourceKey )
+                                    + "]." );
+                }
+                return (LinkValidationResult) this.cache.get( resourceKey );
             }
         }
         lv = null;
@@ -248,6 +263,6 @@
 
     public void setCachedResult( Object resourceKey, LinkValidationResult lvr )
     {
-        cache.put( resourceKey, lvr );
+        this.cache.put( resourceKey, lvr );
     }
 }

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/MailtoLinkValidator.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/MailtoLinkValidator.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/MailtoLinkValidator.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/MailtoLinkValidator.java Sun Mar 25 15:50:05 2007
@@ -24,16 +24,14 @@
  * 
  * Validates mailto links
  */
-public final class MailtoLinkValidator
-    implements LinkValidator
+public final class MailtoLinkValidator implements LinkValidator
 {
     private static final LinkValidationResult LVR = new LinkValidationResult( LinkValidationResult.VALID, false, "" );
 
     /**
      * @see org.apache.maven.plugin.linkcheck.validation.LinkValidator#validateLink(org.apache.maven.plugin.linkcheck.validation.LinkValidationItem)
      */
-    public LinkValidationResult validateLink( LinkValidationItem lvi )
-        throws Exception
+    public LinkValidationResult validateLink( LinkValidationItem lvi ) throws Exception
     {
         return LVR;
     }
@@ -44,9 +42,13 @@
     public Object getResourceKey( LinkValidationItem lvi )
     {
         if ( lvi.getLink().indexOf( '@' ) != -1 )
+        {
             return lvi.getLink();
+        }
         else
+        {
             return null;
+        }
     }
 
 }

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OfflineHTTPLinkValidator.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OfflineHTTPLinkValidator.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OfflineHTTPLinkValidator.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OfflineHTTPLinkValidator.java Sun Mar 25 15:50:05 2007
@@ -19,12 +19,11 @@
 
 /**
  * Fake links check when maven is offline
+ * 
  * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a>
  * @version $Id: HTTPLinkValidator.java 155277 2005-02-24 23:23:29Z aheritier $
  */
-public final class OfflineHTTPLinkValidator
-    extends HTTPLinkValidator
-    implements LinkValidator
+public final class OfflineHTTPLinkValidator extends HTTPLinkValidator implements LinkValidator
 {
 
     /**

Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java Sun Mar 25 15:50:05 2007
@@ -3,9 +3,6 @@
  */
 package org.apache.maven.plugin.linkcheck.validation;
 
-import java.io.IOException;
-import java.net.URL;
-
 import org.apache.commons.httpclient.Credentials;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HostConfiguration;
@@ -23,14 +20,17 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import java.io.IOException;
+import java.net.URL;
+
 /**
  * Checks links which are normal URLs
+ * 
  * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
  * @author <a href="mailto:aheritier@apache.org">Arnaud Heritier</a>
  * @version $Id: HTTPLinkValidator.java 155277 2005-02-24 23:23:29Z aheritier $
  */
-public final class OnlineHTTPLinkValidator
-    extends HTTPLinkValidator
+public final class OnlineHTTPLinkValidator extends HTTPLinkValidator
 {
     /**
      * Log for debug output
@@ -66,7 +66,9 @@
                                     String proxyPass, String proxyNtlmHost, String proxyNtlmDomain )
     {
         if ( LOG.isDebugEnabled() )
+        {
             LOG.debug( "Will use method : [" + method + "]" );
+        }
         this.method = method;
         if ( proxyHost == null || proxyHost.trim().equals( "" ) )
         {
@@ -104,56 +106,58 @@
      */
     public LinkValidationResult validateLink( LinkValidationItem lvi )
     {
-        if ( cl == null )
+        if ( this.cl == null )
+        {
             initHttpClient();
+        }
         try
         {
             String link = lvi.getLink();
             HttpMethod hm = null;
             try
             {
-                hm = checkLink( cl, link, 0 );
+                hm = checkLink( this.cl, link, 0 );
             }
             catch ( Throwable t )
             {
                 if ( LOG.isDebugEnabled() )
                 {
-                    LOG
-                        .error( "Received: [" + t + "] for [" + lvi.getLink() + "] in page [" + lvi.getSource() + "]",
-                                t );
+                    LOG.error( "Received: [" + t + "] for [" + lvi.getLink() + "] in page [" + lvi.getSource() + "]", t );
                 }
                 else
                 {
                     LOG.error( "Received: [" + t + "] for [" + lvi.getLink() + "] in page [" + lvi.getSource() + "]" );
                 }
                 return new LinkValidationResult( LinkValidationResult.ERROR, false, t.getClass().getName() + " : "
-                    + t.getMessage() );
+                                + t.getMessage() );
             }
             if ( hm == null )
+            {
                 return new LinkValidationResult( LinkValidationResult.ERROR, false, "Cannot retreive HTTP Status" );
+            }
             if ( hm.getStatusCode() == HttpStatus.SC_OK )
             {
                 return new LinkValidationResult( LinkValidationResult.VALID, true, hm.getStatusCode() + " "
-                    + hm.getStatusText() );
+                                + hm.getStatusText() );
             }
             else
             {
                 // If there's a redirection ... add a warning
                 if ( hm.getStatusCode() == HttpStatus.SC_MOVED_PERMANENTLY
-                    || hm.getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY
-                    || hm.getStatusCode() == HttpStatus.SC_TEMPORARY_REDIRECT )
+                                || hm.getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY
+                                || hm.getStatusCode() == HttpStatus.SC_TEMPORARY_REDIRECT )
                 {
                     LOG.warn( "Received: [" + hm.getStatusCode() + "] for [" + lvi.getLink() + "] in page ["
-                        + lvi.getSource() + "]" );
+                                    + lvi.getSource() + "]" );
                     return new LinkValidationResult( LinkValidationResult.WARNING, true, hm.getStatusCode() + " "
-                        + hm.getStatusText() );
+                                    + hm.getStatusText() );
                 }
                 else
                 {
                     LOG.error( "Received: [" + hm.getStatusCode() + "] for [" + lvi.getLink() + "] in page ["
-                        + lvi.getSource() + "]" );
+                                    + lvi.getSource() + "]" );
                     return new LinkValidationResult( LinkValidationResult.ERROR, false, hm.getStatusCode() + " "
-                        + hm.getStatusText() );
+                                    + hm.getStatusText() );
                 }
             }
 
@@ -161,9 +165,13 @@
         catch ( Throwable t )
         {
             if ( LOG.isDebugEnabled() )
+            {
                 LOG.error( "Received: [" + t + "] for [" + lvi.getLink() + "] in page [" + lvi.getSource() + "]", t );
+            }
             else
+            {
                 LOG.error( "Received: [" + t + "] for [" + lvi.getLink() + "] in page [" + lvi.getSource() + "]" );
+            }
             return new LinkValidationResult( LinkValidationResult.ERROR, false, t.getMessage() );
         }
     }
@@ -173,7 +181,7 @@
         LOG.debug( "A new HttpClient instance is needed ..." );
         // Some web servers doesn't allow the default user-agent sent by httpClient
         System.setProperty( "httpclient.useragent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" );
-        cl = new HttpClient( new MultiThreadedHttpConnectionManager() );
+        this.cl = new HttpClient( new MultiThreadedHttpConnectionManager() );
         HostConfiguration hc = new HostConfiguration();
         HttpState state = new HttpState();
         if ( this.proxyHost != null )
@@ -181,18 +189,20 @@
             hc.setProxy( this.proxyHost, this.proxyPort );
             if ( LOG.isDebugEnabled() )
             {
-                LOG.debug( "Proxy Host:" + proxyHost );
-                LOG.debug( "Proxy Port:" + proxyPort );
+                LOG.debug( "Proxy Host:" + this.proxyHost );
+                LOG.debug( "Proxy Port:" + this.proxyPort );
             }
             if ( this.proxyUser != null && this.proxyPass != null )
             {
                 if ( LOG.isDebugEnabled() )
-                    LOG.debug( "Proxy User:" + proxyUser );
+                {
+                    LOG.debug( "Proxy User:" + this.proxyUser );
+                }
                 Credentials credentials;
                 if ( this.proxyNtlmHost != null )
                 {
-                    credentials = new NTCredentials( this.proxyUser, this.proxyPass, this.proxyNtlmHost,
-                                                     this.proxyNtlmDomain );
+                    credentials =
+                        new NTCredentials( this.proxyUser, this.proxyPass, this.proxyNtlmHost, this.proxyNtlmDomain );
                 }
                 else
                 {
@@ -206,23 +216,26 @@
         {
             LOG.debug( "Not using a proxy" );
         }
-        cl.setHostConfiguration( hc );
-        cl.setState( state );
+        this.cl.setHostConfiguration( hc );
+        this.cl.setState( state );
         LOG.debug( "New HttpClient instance created." );
     }
 
-    private HttpMethod checkLink( HttpClient cl, String link, int nbRedirect )
-        throws HttpException, IOException
+    private HttpMethod checkLink( HttpClient cl, String link, int nbRedirect ) throws HttpException, IOException
     {
         if ( nbRedirect > MAX_NB_REDIRECT )
         {
             throw new HttpException( "Maximum number of redirections (" + MAX_NB_REDIRECT + ") exceeded" );
         }
         HttpMethod hm;
-        if ( HEAD_METHOD.equals( method ) )
+        if ( HEAD_METHOD.equals( this.method ) )
+        {
             hm = new HeadMethod( link );
+        }
         else
+        {
             hm = new GetMethod( link );
+        }
         try
         {
             // We want to do it manually
@@ -239,8 +252,8 @@
             }
 
             if ( hm.getStatusCode() == HttpStatus.SC_MOVED_PERMANENTLY
-                || hm.getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY
-                || hm.getStatusCode() == HttpStatus.SC_TEMPORARY_REDIRECT )
+                            || hm.getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY
+                            || hm.getStatusCode() == HttpStatus.SC_TEMPORARY_REDIRECT )
             {
                 Header locationHeader = hm.getResponseHeader( "location" );
                 if ( locationHeader == null )
@@ -257,8 +270,9 @@
                         if ( newLink.startsWith( "/" ) )
                         {
                             URL oldUrl = new URL( link );
-                            newLink = oldUrl.getProtocol() + "://" + oldUrl.getHost()
-                                + ( oldUrl.getPort() > 0 ? ":" + oldUrl.getPort() : "" ) + newLink;
+                            newLink =
+                                oldUrl.getProtocol() + "://" + oldUrl.getHost()
+                                                + ( oldUrl.getPort() > 0 ? ":" + oldUrl.getPort() : "" ) + newLink;
                         }
                         else
                         {
@@ -269,9 +283,9 @@
                     LOG.info( "[" + link + "] is redirected to [" + newLink + "]" );
                     oldHm.releaseConnection();
                     hm = checkLink( cl, newLink, nbRedirect + 1 );
-                    // Restore the hm to "Moved permanently" | "Moved temporarily" | "Temporary redirect" 
+                    // Restore the hm to "Moved permanently" | "Moved temporarily" | "Temporary redirect"
                     // if the new location is found to allow us to report it
-                    if ( hm.getStatusCode() == HttpStatus.SC_OK && nbRedirect == 0)
+                    if ( hm.getStatusCode() == HttpStatus.SC_OK && nbRedirect == 0 )
                     {
                         return oldHm;
                     }

Modified: maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/LinkCheckTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/LinkCheckTest.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/LinkCheckTest.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/LinkCheckTest.java Sun Mar 25 15:50:05 2007
@@ -17,6 +17,10 @@
  * ====================================================================
  */
 
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
 import java.io.File;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -24,10 +28,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-
 /**
  * @author Ben Walding
  * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
@@ -44,7 +44,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        baseDir = System.getProperty( "basedir" );
+        this.baseDir = System.getProperty( "basedir" );
         // Setup log4J (We are in a forked JVM for tests)
         BasicConfigurator.configure();
         Logger.getLogger( "org.apache.maven.plugin.linkcheck" ).setLevel( Level.DEBUG );
@@ -52,10 +52,10 @@
 
     public void testScan() throws Exception
     {
-        File f = new File( baseDir + "/src/test-resources" );
+        File f = new File( this.baseDir + "/src/test-resources" );
         LinkCheck lc = new LinkCheck();
         lc.setBasedir( f );
-        lc.setOutput( new File( baseDir + "/target/linkcheck.xml" ) );
+        lc.setOutput( new File( this.baseDir + "/target/linkcheck.xml" ) );
         lc.setOutputEncoding( "ISO8859-1" );
         lc.setCache( System.getProperty( "maven.linkcheck.cache" ) );
         lc.setExclude( "http://cvs.apache.org/viewcvs.cgi/maven-pluginszz/,"

Modified: maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java?view=diff&rev=522369&r1=522368&r2=522369
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java Sun Mar 25 15:50:05 2007
@@ -17,14 +17,14 @@
  * ====================================================================
  */
 
-import java.io.File;
-
-import junit.framework.TestCase;
-
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 
+import java.io.File;
+
+import junit.framework.TestCase;
+
 /**
  * @author <a href="bwalding@apache.org">Ben Walding</a>
  * @author <a href="aheritier@apache.org">Arnaud Heritier</a>
@@ -51,9 +51,9 @@
 
     public void testValidateLink() throws Exception
     {
-        if ( mavenOnline )
+        if ( this.mavenOnline )
         {
-            hlv =
+            this.hlv =
                 new OnlineHTTPLinkValidator( System.getProperty( "maven.linkcheck.method" ),
                                              System.getProperty( "maven.linkcheck.proxy.host" ),
                                              System.getProperty( "maven.linkcheck.proxy.port" ),
@@ -67,7 +67,7 @@
         }
         else
         {
-            hlv = new OfflineHTTPLinkValidator();
+            this.hlv = new OfflineHTTPLinkValidator();
 
             assertEquals( LinkValidationResult.WARNING, checkLink( "http://www.apache.org" ).getStatus() );
             assertEquals( LinkValidationResult.WARNING, checkLink( "http://www.example.com>);" ).getStatus() );
@@ -79,7 +79,7 @@
     {
 
         LinkValidationItem lvi = new LinkValidationItem( new File( "." ), link );
-        return hlv.validateLink( lvi );
+        return this.hlv.validateLink( lvi );
     }
 
 }



Mime
View raw message