You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2013/06/30 16:55:13 UTC

svn commit: r1498139 - in /maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging: AbstractWarPackagingTask.java ArtifactsPackagingTask.java WarPackagingContext.java WarProjectPackagingTask.java

Author: rfscholte
Date: Sun Jun 30 14:55:13 2013
New Revision: 1498139

URL: http://svn.apache.org/r1498139
Log:
Apply generics

Modified:
    maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
    maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java
    maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java
    maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java

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=1498139&r1=1498138&r2=1498139&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 Jun 30 14:55:13 2013
@@ -21,8 +21,8 @@ package org.apache.maven.plugin.war.pack
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Iterator;
 
+import org.apache.commons.io.input.XmlStreamReader;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.war.AbstractWarMojo;
@@ -38,7 +38,6 @@ import org.codehaus.plexus.interpolation
 import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
-import org.apache.commons.io.input.XmlStreamReader;
 
 /**
  * @author Stephane Nicoll

Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java?rev=1498139&r1=1498138&r2=1498139&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java Sun Jun 30 14:55:13 2013
@@ -19,18 +19,17 @@ package org.apache.maven.plugin.war.pack
  * under the License.
  */
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.war.Overlay;
 import org.codehaus.plexus.interpolation.InterpolationException;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
 /**
  * Handles the artifacts that needs to be packaged in the web application.
  *
@@ -50,12 +49,12 @@ public class ArtifactsPackagingTask
 
     public static final String EXTENSIONS_PATH = "WEB-INF/extensions/";
 
-    private final Set artifacts;
+    private final Set<Artifact> artifacts;
 
     private final String id;
 
 
-    public ArtifactsPackagingTask( Set artifacts, Overlay currentProjectOverlay )
+    public ArtifactsPackagingTask( Set<Artifact> artifacts, Overlay currentProjectOverlay )
     {
         this.artifacts = artifacts;
         this.id = currentProjectOverlay.getId();
@@ -68,11 +67,10 @@ public class ArtifactsPackagingTask
         try
         {
         final ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
-        final List duplicates = findDuplicates( context, artifacts );
+        final List<String> duplicates = findDuplicates( context, artifacts );
 
-        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+        for ( Artifact artifact : artifacts )
         {
-            Artifact artifact = (Artifact) iter.next();
             String targetFileName = getArtifactFinalName( context, artifact );
 
             context.getLog().debug( "Processing: " + targetFileName );
@@ -153,14 +151,13 @@ public class ArtifactsPackagingTask
      * @param artifacts set of artifacts
      * @return List of duplicated artifacts as bundling file names
      */
-    private List findDuplicates( WarPackagingContext context, Set artifacts ) 
+    private List<String> findDuplicates( WarPackagingContext context, Set<Artifact> artifacts )
         throws InterpolationException
     {
-        List duplicates = new ArrayList();
-        List identifiers = new ArrayList();
-        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+        List<String> duplicates = new ArrayList<String>();
+        List<String> identifiers = new ArrayList<String>();
+        for ( Artifact artifact : artifacts )
         {
-            Artifact artifact = (Artifact) iter.next();
             String candidate = getArtifactFinalName( context, artifact );
             if ( identifiers.contains( candidate ) )
             {

Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java?rev=1498139&r1=1498138&r2=1498139&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java Sun Jun 30 14:55:13 2013
@@ -148,7 +148,7 @@ public interface WarPackagingContext
      *
      * @return a list of filter files
      */
-    List getFilters();
+    List<String> getFilters();
 
     /**
      * Returns the {@link WebappStructure}.
@@ -160,12 +160,12 @@ public interface WarPackagingContext
     /**
      * Returns the list of registered overlays for this session. This list might
      * differ from the one returned by the cache; in this case, it means that the
-     * project's configuration has changed. The plugin will handle thos cases nicely
+     * project's configuration has changed. The plugin will handle those cases nicely
      * but it would be better in general to invoke the clean goal.
      *
      * @return the list of registered overlays, including the current project
      */
-    List getOwnerIds();
+    List<String> getOwnerIds();
     
     /**
      * Returns the {@link MavenFileFilter} instance to use.
@@ -179,7 +179,7 @@ public interface WarPackagingContext
      * @return {@link List} of {@link FilterWrapper}
      * @since 2.1-alpha-2
      */
-    List getFilterWrappers();
+    List<FilterWrapper> getFilterWrappers();
     
     /**
      * Specify if the given <tt>fileName</tt> belongs to the list of extensions

Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java?rev=1498139&r1=1498138&r2=1498139&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java Sun Jun 30 14:55:13 2013
@@ -19,6 +19,9 @@ package org.apache.maven.plugin.war.pack
  * under the License.
  */
 
+import java.io.File;
+import java.io.IOException;
+
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -28,10 +31,6 @@ import org.apache.maven.shared.filtering
 import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-
 /**
  * Handles the project own resources, that is:
  * <ul
@@ -94,9 +93,9 @@ public class WarProjectPackagingTask
         // Debug mode: dump the path set for the current build
         PathSet pathSet = context.getWebappStructure().getStructure( "currentBuild" );
         context.getLog().debug( "Dump of the current build pathSet content -->" );
-        for ( Iterator iterator = pathSet.iterator(); iterator.hasNext(); )
+        for ( String path : pathSet )
         {
-            context.getLog().debug( "" + iterator.next() );
+            context.getLog().debug( path );
         }
         context.getLog().debug( "-- end of dump --" );
 
@@ -189,6 +188,7 @@ public class WarProjectPackagingTask
     protected void handleArtifacts( WarPackagingContext context )
         throws MojoExecutionException
     {
+        @SuppressWarnings( "unchecked" )
         ArtifactsPackagingTask task = new ArtifactsPackagingTask( context.getProject().getArtifacts(),
                                                                   currentProjectOverlay );
         task.performPackaging( context );