From 1d929b31fb2db2a28c3ea10f135f4b841041a513 Mon Sep 17 00:00:00 2001 From: Eric Barboni Date: Thu, 17 Apr 2014 22:13:54 +0200 Subject: [PATCH] jdk7 (multicatch diamond) --- .../DefaultArchivaConfiguration.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java index bea3eff64..6373a503b 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java @@ -147,12 +147,12 @@ public class DefaultArchivaConfiguration /** * Configuration Listeners we've registered. */ - private Set listeners = new HashSet(); + private Set listeners = new HashSet<>(); /** * Registry Listeners we've registered. */ - private Set registryListeners = new HashSet(); + private Set registryListeners = new HashSet<>(); /** * Boolean to help determine if the configuration exists as a result of pulling in @@ -204,9 +204,8 @@ public class DefaultArchivaConfiguration config.getRepositoryGroupsAsMap(); if ( !config.getRepositories().isEmpty() ) { - for ( Iterator i = config.getRepositories().iterator(); i.hasNext(); ) + for ( V1RepositoryConfiguration r : config.getRepositories() ) { - V1RepositoryConfiguration r = i.next(); r.setScanned( r.isIndexed() ); if ( StringUtils.startsWith( r.getUrl(), "file://" ) ) @@ -699,11 +698,7 @@ public class DefaultArchivaConfiguration loadConfiguration(); handleUpgradeConfiguration(); } - catch ( IndeterminateConfigurationException e ) - { - throw new RuntimeException( "failed during upgrade from previous version" + e.getMessage(), e ); - } - catch ( RegistryException e ) + catch ( IndeterminateConfigurationException | RegistryException e ) { throw new RuntimeException( "failed during upgrade from previous version" + e.getMessage(), e ); } @@ -814,9 +809,7 @@ public class DefaultArchivaConfiguration private Configuration unescapeExpressions( Configuration config ) { // TODO: for commons-configuration 1.3 only - for ( Iterator i = config.getManagedRepositories().iterator(); i.hasNext(); ) - { - ManagedRepositoryConfiguration c = i.next(); + for ( ManagedRepositoryConfiguration c : config.getManagedRepositories() ) { c.setLocation( removeExpressions( c.getLocation() ) ); c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) ); } -- 2.39.5