Author: hboutemy
Date: Sun Apr 15 15:51:33 2012
New Revision: 1326369

URL: http://svn.apache.org/viewvc?rev=1326369&view=rev
Log:
removed class attribute: local variable when necessary is better suited

Modified:
    
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
    
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java
    
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java

Modified: 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java?rev=1326369&r1=1326368&r2=1326369&view=diff
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
 (original)
+++ 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
 Sun Apr 15 15:51:33 2012
@@ -185,8 +185,6 @@ public abstract class AbstractScmPublish
 
     protected ScmProvider scmProvider;
     protected ScmRepository scmRepository;
-    // a list (ordered) to maintain sort for ease of comparison.
-    protected List<File> inventory;
 
     protected static class DotFilter
         implements IOFileFilter
@@ -226,12 +224,13 @@ public abstract class AbstractScmPublish
      * git? Or use 
http://plexus.codehaus.org/plexus-utils/apidocs/org/codehaus/plexus/util/AbstractScanner.html#DEFAULTEXCLUDES?
      * @throws MojoFailureException 
      */
-    protected void writeInventory()
+    protected List<File> writeInventory()
         throws MojoFailureException
     {
-        inventory = new ArrayList<File>();
+        List<File> inventory = new ArrayList<File>();
         inventory.addAll( FileUtils.listFiles( checkoutDirectory, new 
DotFilter(), new DotFilter() ) );
         Collections.sort( inventory );
+
         ScmPublishInventory initialInventory = new ScmPublishInventory();
         Set<String> paths = new HashSet<String>();
 
@@ -253,6 +252,7 @@ public abstract class AbstractScmPublish
             JsonGenerator gen = factory.createJsonGenerator( inventoryFile, 
JsonEncoding.UTF8 );
             gen.writeObject( initialInventory );
             gen.close();
+            return inventory;
         }
         catch ( JsonProcessingException e )
         {
@@ -264,7 +264,7 @@ public abstract class AbstractScmPublish
         }
     }
 
-    protected void readInventory()
+    protected List<File> readInventory()
         throws MojoFailureException
     {
         try
@@ -272,12 +272,13 @@ public abstract class AbstractScmPublish
             MappingJsonFactory factory = new MappingJsonFactory();
             JsonParser parser = factory.createJsonParser( inventoryFile );
             ScmPublishInventory storedInventory = parser.readValueAs( 
ScmPublishInventory.class );
-            inventory = new ArrayList<File>();
+            List<File> inventory = new ArrayList<File>();
             for ( String p : storedInventory.getPaths() )
             {
                 inventory.add( new File( p ) );
             }
             parser.close();
+            return inventory;
         }
         catch ( JsonProcessingException e )
         {

Modified: 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java?rev=1326369&r1=1326368&r2=1326369&view=diff
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java
 (original)
+++ 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java
 Sun Apr 15 15:51:33 2012
@@ -21,6 +21,7 @@ package org.apache.maven.plugins.scmpubl
 
 import java.io.File;
 import java.io.IOException;
+import java.util.List;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -37,9 +38,12 @@ import org.apache.maven.shared.release.u
 import org.codehaus.plexus.util.StringUtils;
 
 /**
- * Prepare a directory for version-managed site generation. This checks out 
the specified directory from the SCM and
- * then takes inventory of all the resulting files. This inventory then allows 
the 'checkin' target to tee up deletions
- * as well as modifications and additions. There's an assumption here that an 
entire directory in SCM is dedicated to
+ * Prepare a directory for version-managed site generation. This checks out 
the specified directory from the SCM,
+ * then takes inventory of all the resulting files then deletes every files.
+ * This inventory then allows the 'publish' target to tee up deletions
+ * as well as modifications and additions.
+ * 
+ * There's an assumption here that an entire directory in SCM is dedicated to
  * the publication process for this project. In the aggregate case, this is 
going to take some doing. 
  * 
  * If we allow this to be non-aggregate, then each module has to configure 
pathnames, which would be a pain. So
@@ -150,7 +154,7 @@ public class ScmPublishInventoryMojo
      * For now, don't bother with deleting empty directories. They are fairly 
harmless,
      * and leaving them around allows this to work with pre-1.7 svn.
      */
-    private void deleteInventory() 
+    private void deleteInventory( List<File> inventory ) 
     {
         for ( File f : inventory )
         {
@@ -167,16 +171,18 @@ public class ScmPublishInventoryMojo
         try
         {
             checkoutExisting();
-            writeInventory();
-            deleteInventory();
+
+            List<File> inventory = writeInventory();
+
+            deleteInventory( inventory );
         }
         catch ( ReleaseExecutionException e )
         {
-            throw new MojoExecutionException( e.getMessage() );
+            throw new MojoExecutionException( e.getMessage(), e );
         }
         catch ( ReleaseFailureException e )
         {
-            throw new MojoFailureException( e.getMessage() );
+            throw new MojoFailureException( e.getMessage(), e );
         }
     }
 }

Modified: 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java?rev=1326369&r1=1326368&r2=1326369&view=diff
==============================================================================
--- 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java
 (original)
+++ 
maven/sandbox/trunk/plugins/maven-site-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java
 Sun Apr 15 15:51:33 2012
@@ -160,7 +160,7 @@ public class ScmPublishPublishMojo
         }
 
         // read in the list left behind by prepare; fail if it's not there.
-        readInventory();
+        List<File> inventory = readInventory();
 
         // setup the scm plugin with help from release plugin utilities
         try


Reply via email to