You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by hb...@apache.org on 2009/08/14 09:29:08 UTC

svn commit: r804101 - /maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/DefaultLinkCheck.java

Author: hboutemy
Date: Fri Aug 14 07:29:08 2009
New Revision: 804101

URL: http://svn.apache.org/viewvc?rev=804101&view=rev
Log:
replaced model attribute by local variable in execute() method propagated in method calls

Modified:
    maven/doxia/doxia-tools/trunk/doxia-linkcheck/src/main/java/org/apache/maven/doxia/linkcheck/DefaultLinkCheck.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=804101&r1=804100&r2=804101&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 Fri Aug 14 07:29:08 2009
@@ -120,9 +120,6 @@
     /** The base URL for links that start with '/'. */
     private String baseURL;
 
-    /** The linkcheck model */
-    private LinkcheckModel model = new LinkcheckModel();
-
     /** The encoding used to process files, UTF-8 by default. */
     private String encoding = ReaderFactory.UTF_8;
 
@@ -218,7 +215,7 @@
             }
         }
 
-        model = new LinkcheckModel();
+        LinkcheckModel model = new LinkcheckModel();
         model.setModelEncoding( reportOutputEncoding );
         model.setFiles( new LinkedList() );
 
@@ -241,7 +238,7 @@
             LOG.info( "Begin to check links in files..." );
         }
 
-        findAndCheckFiles( this.basedir );
+        findAndCheckFiles( this.basedir, model );
 
         if ( LOG.isInfoEnabled() )
         {
@@ -252,7 +249,7 @@
 
         try
         {
-            createDocument();
+            createDocument( model );
         }
         catch ( IOException e )
         {
@@ -270,11 +267,7 @@
 
         displayMemoryConsumption();
 
-        // free memory
-        LinkcheckModel returnValue = model;
-        model = null;
-
-        return returnValue;
+        return model;
     }
 
     /** {@inheritDoc} */
@@ -365,16 +358,6 @@
     }
 
     /**
-     * The model.
-     *
-     * @return the model.
-     */
-    private LinkcheckModel getModel()
-    {
-        return model;
-    }
-
-    /**
      * Sets the LinkValidatorManager.
      *
      * @param validator the LinkValidatorManager to set
@@ -440,7 +423,7 @@
      *
      * @param base the base directory to traverse.
      */
-    private void findAndCheckFiles( File base )
+    private void findAndCheckFiles( File base, LinkcheckModel model )
     {
         File[] f = base.listFiles( CUSTOM_FF );
 
@@ -453,7 +436,7 @@
 
                 if ( file.isDirectory() )
                 {
-                    findAndCheckFiles( file );
+                    findAndCheckFiles( file, model );
                 }
                 else
                 {
@@ -681,7 +664,7 @@
      *
      * @throws IOException if any
      */
-    private void createDocument()
+    private void createDocument( LinkcheckModel model )
         throws IOException
     {
         if ( this.reportOutput == null )
@@ -700,7 +683,7 @@
         try
         {
             writer = WriterFactory.newXmlWriter( this.reportOutput );
-            xpp3Writer.write( writer, getModel() );
+            xpp3Writer.write( writer, model );
         }
         catch ( IllegalStateException e )
         {