Author: snicoll
Date: Sun Dec 23 14:37:58 2007
New Revision: 606629

URL: http://svn.apache.org/viewvc?rev=606629&view=rev
Log:
a bit of cleaning, too much debug statements.

Modified:
    
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
    
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java

Modified: 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java?rev=606629&r1=606628&r2=606629&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
 (original)
+++ 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
 Sun Dec 23 14:37:58 2007
@@ -19,18 +19,19 @@
  * under the License.
  */
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.plugin.war.Overlay;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.StringUtils;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+
 /**
  * Manages the overlays.
  *
@@ -43,7 +44,7 @@
     private final MavenProject project;
 
     private final List artifactsOverlays;
-    
+
     /**
      * Creates a manager with the specified overlays.
      * <p/>
@@ -68,12 +69,12 @@
         this.project = project;
 
         this.artifactsOverlays = getOverlaysAsArtifacts();
-        
+
         // Initialize
         initialize( defaultIncludes, defaultExcludes );
-        
+
     }
-    
+
 
     /**
      * Returns the resolved overlays.
@@ -133,8 +134,8 @@
                 it.set( overlay );
             }
             // default includes/excludes - only if the overlay uses the 
default settings
-            if ( Overlay.DEFAULT_INCLUDES.equals( overlay.getIncludes() )
-                && Overlay.DEFAULT_EXCLUDES.equals( overlay.getExcludes() ) )
+            if ( Arrays.equals( Overlay.DEFAULT_INCLUDES, 
overlay.getIncludes() ) &&
+                Arrays.equals( Overlay.DEFAULT_EXCLUDES, overlay.getExcludes() 
) )
             {
                 overlay.setIncludes( defaultIncludes );
                 overlay.setExcludes( defaultExcludes );
@@ -203,7 +204,7 @@
                 return artifact;
             }
         }
-        
+
         // maybe its a project dependencies zip or an other type
         Set projectArtifacts = this.project.getDependencyArtifacts();
         if ( projectArtifacts != null )
@@ -221,28 +222,28 @@
             "overlay[" + overlay + "] is not a dependency of the project." );
 
     }
-    
+
     /**
      * compare groupId && artifactId && Type && classifier
-     * @param overlay
-     * @param artifact
+     * @param overlay the overlay
+     * @param artifact the artifact
      * @return boolean true if equals
      */
     private boolean compareOverlayWithArtifact( Overlay overlay, Artifact 
artifact )
     {
-       return ( StringUtils.equals( overlay.getGroupId(), 
artifact.getGroupId() )
-            && StringUtils.equals( overlay.getArtifactId(), 
artifact.getArtifactId() )
-            && StringUtils.equals( overlay.getType(), artifact.getType() ) 
-            && ( overlay.getClassifier() == null || ( StringUtils
-            .equals( overlay.getClassifier(), artifact.getClassifier() ) ) ) );
+        return ( StringUtils.equals( overlay.getGroupId(), 
artifact.getGroupId() ) &&
+            StringUtils.equals( overlay.getArtifactId(), 
artifact.getArtifactId() ) &&
+            StringUtils.equals( overlay.getType(), artifact.getType() ) &&
+            ( overlay.getClassifier() == null || ( StringUtils
+                .equals( overlay.getClassifier(), artifact.getClassifier() ) ) 
) );
     }
-    
+
     /**
      * Returns a list of war [EMAIL PROTECTED] 
org.apache.maven.artifact.Artifact} describing
      * the overlays of the current project.
      *
      * @return the overlays as artifacts objects
-     */    
+     */
     private List getOverlaysAsArtifacts()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter( 
Artifact.SCOPE_RUNTIME );

Modified: 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java?rev=606629&r1=606628&r2=606629&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
 (original)
+++ 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
 Sun Dec 23 14:37:58 2007
@@ -136,44 +136,33 @@
                              String targetFilename )
         throws IOException
     {
-        context.getLog().debug(
-                                "sourceId " + sourceId + ", copyFile file " + 
file + ", targetFilename "
-                                    + targetFilename );
         final File targetFile = new File( context.getWebappDirectory(), 
targetFilename );
         context.getWebappStructure().registerFile( sourceId, targetFilename, 
new WebappStructure.RegistrationCallback()
         {
             public void registered( String ownerId, String targetFilename )
                 throws IOException
             {
-                context.getLog().debug(
-                                        "registered copy file " + 
file.getPath() + " to targetFile "
-                                            + targetFile.getName() );
                 copyFile( context, file, targetFile, targetFilename, false );
             }
 
             public void alreadyRegistered( String ownerId, String 
targetFilename )
                 throws IOException
             {
-                context.getLog().debug(
-                                        "alreadyRegistered copy onlyIfModified 
file " + file.getPath()
-                                            + " to targetFile " + 
targetFile.getName() );
                 copyFile( context, file, targetFile, targetFilename, true );
             }
 
             public void refused( String ownerId, String targetFilename, String 
actualOwnerId )
                 throws IOException
             {
-                context.getLog().debug(
-                                        " - " + targetFilename + " wasn't 
copied because it has "
-                                            + "already been packaged for 
overlay[" + actualOwnerId + "]." );
+                context.getLog().debug( " - " + targetFilename + " wasn't 
copied because it has " +
+                    "already been packaged for overlay[" + actualOwnerId + 
"]." );
             }
 
             public void superseded( String ownerId, String targetFilename, 
String deprecatedOwnerId )
                 throws IOException
             {
-                context.getLog().info(
-                                       "File[" + targetFilename + "] belonged 
to overlay[" + deprecatedOwnerId
-                                           + "] so it will be overwritten." );
+                context.getLog().info( "File[" + targetFilename + "] belonged 
to overlay[" + deprecatedOwnerId +
+                    "] so it will be overwritten." );
                 copyFile( context, file, targetFile, targetFilename, false );
             }
 
@@ -181,10 +170,9 @@
                 throws IOException
             {
                 context.getLog()
-                    .warn(
-                           "File[" + targetFilename + "] belonged to overlay[" 
+ unknownOwnerId
-                               + "] which does not exist anymore in the 
current project. It is recommended to invoke "
-                               + "clean if the dependencies of the project 
changed." );
+                    .warn( "File[" + targetFilename + "] belonged to overlay[" 
+ unknownOwnerId +
+                        "] which does not exist anymore in the current 
project. It is recommended to invoke " +
+                        "clean if the dependencies of the project changed." );
                 copyFile( context, file, targetFile, targetFilename, false );
             }
         } );
@@ -209,13 +197,9 @@
         throws IOException, MojoExecutionException
     {
 
-        context.getLog().debug(
-                                "sourceId " + sourceId + ", filtering file " + 
file + " to targetFilename "
-                                    + targetFilename );
         if ( context.getWebappStructure().registerFile( sourceId, 
targetFilename ) )
         {
             final File targetFile = new File( context.getWebappDirectory(), 
targetFilename );
-            context.getLog().debug( "filtering file " + file + " to targetFile 
" + targetFile );
             // buffer so it isn't reading a byte at a time!
             Reader fileReader = null;
             Writer fileWriter = null;
@@ -242,12 +226,13 @@
                 IOUtil.close( fileWriter );
             }
             // Add the file to the protected list
-            context.getLog().debug( " + " + targetFilename + " has been 
copied." );
+            context.getLog().debug( " + " + targetFilename + " has been copied 
(filtered)." );
             return true;
         }
         else
         {
-            context.getLog().debug( " - " + targetFilename + " wasn't copied 
because it has already been packaged." );
+            context.getLog().debug(
+                " - " + targetFilename + " wasn't copied because it has 
already been packaged (filtered)." );
             return false;
         }
     }
@@ -276,19 +261,18 @@
         }
         catch ( IOException e )
         {
-            throw new MojoExecutionException( "Error unpacking file[" + 
file.getAbsolutePath() + "]" + "to["
-                + unpackDirectory.getAbsolutePath() + "]", e );
+            throw new MojoExecutionException( "Error unpacking file[" + 
file.getAbsolutePath() + "]" + "to[" +
+                unpackDirectory.getAbsolutePath() + "]", e );
         }
         catch ( ArchiverException e )
         {
-            throw new MojoExecutionException( "Error unpacking file[" + 
file.getAbsolutePath() + "]" + "to["
-                + unpackDirectory.getAbsolutePath() + "]", e );
+            throw new MojoExecutionException( "Error unpacking file[" + 
file.getAbsolutePath() + "]" + "to[" +
+                unpackDirectory.getAbsolutePath() + "]", e );
         }
         catch ( NoSuchArchiverException e )
         {
-            context.getLog().warn(
-                                   "Skip unpacking dependency file[" + 
file.getAbsolutePath()
-                                       + " with unknown extension[" + 
archiveExt + "]" );
+            context.getLog().warn( "Skip unpacking dependency file[" + 
file.getAbsolutePath() +
+                " with unknown extension[" + archiveExt + "]" );
         }
     }
 
@@ -413,7 +397,7 @@
                 {
                     return new InterpolationFilterReader( fileReader, 
filterProperties, "@", "@" );
                 }
-            } };
+            }};
     }
 
     /**


Reply via email to