Author: hboutemy
Date: Sun Feb 26 17:29:38 2012
New Revision: 1293886

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

Modified:
    
maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java

Modified: 
maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1293886&r1=1293885&r2=1293886&view=diff
==============================================================================
--- 
maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
 (original)
+++ 
maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
 Sun Feb 26 17:29:38 2012
@@ -466,10 +466,8 @@ public abstract class AbstractDeployMojo
 
         String host = repository.getHost();
         String nonProxyHostsAsString = proxyInfo.getNonProxyHosts();
-        String[] nonProxyHosts = StringUtils.split( nonProxyHostsAsString, 
",;|" );
-        for ( int i = 0; i < nonProxyHosts.length; i++ )
+        for ( String nonProxyHost : StringUtils.split( nonProxyHostsAsString, 
",;|" ) )
         {
-            String nonProxyHost = nonProxyHosts[i];
             if ( StringUtils.contains( nonProxyHost, "*" ) )
             {
                 // Handle wildcard at the end, beginning or middle of the 
nonProxyHost
@@ -521,48 +519,43 @@ 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 );
-                        componentConfigurator.configureComponent( wagon, 
plexusConf, container.getContainerRealm() );
-                    }
-                    catch ( final ComponentLookupException e )
-                    {
-                        throw new WagonConfigurationException( repositoryId, 
"Unable to lookup wagon configurator."
-                            + " Wagon configuration cannot be applied.", e );
-                    }
-                    catch ( ComponentConfigurationException e )
-                    {
-                        throw new WagonConfigurationException( repositoryId, 
"Unable to apply wagon configuration.",
-                            e );
-                    }
-                    finally
+                ComponentConfigurator componentConfigurator = null;
+                try
+                {
+                    componentConfigurator = (ComponentConfigurator) 
container.lookup( ComponentConfigurator.ROLE );
+                    componentConfigurator.configureComponent( wagon, 
plexusConf, container.getContainerRealm() );
+                }
+                catch ( final ComponentLookupException e )
+                {
+                    throw new WagonConfigurationException( repositoryId, 
"Unable to lookup wagon configurator."
+                        + " Wagon configuration cannot be applied.", e );
+                }
+                catch ( ComponentConfigurationException e )
+                {
+                    throw new WagonConfigurationException( 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