You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2018/01/03 17:41:30 UTC

[maven-site-plugin] 17/30: use Java 5 for loop

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-site-plugin-2.4
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git

commit 69d5bce654ee0e6905f91ba9133f993066682ef0
Author: Herve Boutemy <hb...@apache.org>
AuthorDate: Sun Feb 26 17:29:38 2012 +0000

    use Java 5 for loop
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/branches/maven-site-plugin-2.x@1293886 13f79535-47bb-0310-9956-ffa450edef68
---
 .../maven/plugins/site/AbstractDeployMojo.java     | 65 ++++++++++------------
 1 file changed, 29 insertions(+), 36 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java b/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
index 728d77b..140fc3e 100644
--- a/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
@@ -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() );
                         }
                     }
                 }

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.