Author: hboutemy
Date: Sun Feb 26 17:26:19 2012
New Revision: 1293883

URL: http://svn.apache.org/viewvc?rev=1293883&view=rev
Log:
use Java 5 for loop

Modified:
    
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java

Modified: 
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1293883&r1=1293882&r2=1293883&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
 Sun Feb 26 17:26:19 2012
@@ -654,58 +654,54 @@ public abstract class AbstractDeployMojo
         log.debug( " configureWagon " );
 
         // MSITE-25: Make sure that the server settings are inserted
-        for ( int i = 0; i < settings.getServers().size(); i++ )
+        for ( Server server : settings.getServers() )
         {
-            Server server = settings.getServers().get( i );
             String id = server.getId();
 
             log.debug( "configureWagon server " + id );
 
-            if ( id != null && id.equals( repositoryId ) )
+            if ( id != null && id.equals( repositoryId ) && ( 
server.getConfiguration() != null ) )
             {
-                if ( server.getConfiguration() != null )
-                {
-                    final PlexusConfiguration plexusConf =
-                        new XmlPlexusConfiguration( (Xpp3Dom) 
server.getConfiguration() );
+                final PlexusConfiguration plexusConf =
+                    new XmlPlexusConfiguration( (Xpp3Dom) 
server.getConfiguration() );
 
-                    ComponentConfigurator componentConfigurator = null;
-                    try
-                    {
-                        componentConfigurator =
-                            (ComponentConfigurator) container.lookup( 
ComponentConfigurator.ROLE, "basic" );
-                        if ( isMaven3OrMore() )
-                        {
-                            componentConfigurator.configureComponent( wagon, 
plexusConf,
-                                                                      
container.getContainerRealm() );
-                        }
-                        else
-                        {
-                            configureWagonWithMaven2( componentConfigurator, 
wagon, plexusConf, container );
-                        }
-                    }
-                    catch ( final ComponentLookupException e )
+                ComponentConfigurator componentConfigurator = null;
+                try
+                {
+                    componentConfigurator =
+                        (ComponentConfigurator) container.lookup( 
ComponentConfigurator.ROLE, "basic" );
+                    if ( isMaven3OrMore() )
                     {
-                        throw new TransferFailedException(
-                            "While configuring wagon for \'" + repositoryId + 
"\': Unable to lookup wagon configurator."
-                                + " Wagon configuration cannot be applied.", e 
);
+                        componentConfigurator.configureComponent( wagon, 
plexusConf,
+                                                                  
container.getContainerRealm() );
                     }
-                    catch ( ComponentConfigurationException e )
+                    else
                     {
-                        throw new TransferFailedException( "While configuring 
wagon for \'" + repositoryId
-                                                               + "\': Unable 
to apply wagon configuration.", e );
+                        configureWagonWithMaven2( componentConfigurator, 
wagon, plexusConf, container );
                     }
-                    finally
+                }
+                catch ( final ComponentLookupException e )
+                {
+                    throw new TransferFailedException(
+                        "While configuring wagon for \'" + repositoryId + "\': 
Unable to lookup wagon configurator."
+                            + " Wagon configuration cannot be applied.", e );
+                }
+                catch ( ComponentConfigurationException e )
+                {
+                    throw new TransferFailedException( "While configuring 
wagon for \'" + repositoryId
+                                                           + "\': Unable to 
apply wagon configuration.", e );
+                }
+                finally
+                {
+                    if ( componentConfigurator != null )
                     {
-                        if ( componentConfigurator != null )
+                        try
+                        {
+                            container.release( componentConfigurator );
+                        }
+                        catch ( ComponentLifecycleException e )
                         {
-                            try
-                            {
-                                container.release( componentConfigurator );
-                            }
-                            catch ( ComponentLifecycleException e )
-                            {
-                                log.error( "Problem releasing configurator - 
ignoring: " + e.getMessage() );
-                            }
+                            log.error( "Problem releasing configurator - 
ignoring: " + e.getMessage() );
                         }
                     }
                 }


Reply via email to