diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java index 04355df68..f4c99d5d1 100644 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java @@ -83,7 +83,7 @@ public class DefaultArchivaConfiguration /** * Listeners we've registered. */ - private List listeners = new LinkedList(); + private List listeners = new LinkedList(); public String getFilteredUserConfigFilename() { @@ -119,9 +119,9 @@ public class DefaultArchivaConfiguration if ( !config.getRepositories().isEmpty() ) { - for ( Iterator i = config.getRepositories().iterator(); i.hasNext(); ) + for ( Iterator i = config.getRepositories().iterator(); i.hasNext(); ) { - V1RepositoryConfiguration r = (V1RepositoryConfiguration) i.next(); + V1RepositoryConfiguration r = i.next(); r.setScanned( r.isIndexed() ); if ( r.getUrl().startsWith( "file://" ) ) @@ -145,7 +145,7 @@ public class DefaultArchivaConfiguration } } } - + return config; } @@ -181,11 +181,11 @@ public class DefaultArchivaConfiguration } else if ( baseSection != null ) { - Collection keys = baseSection.getKeys(); + Collection keys = baseSection.getKeys(); boolean foundList = false; - for ( Iterator i = keys.iterator(); i.hasNext() && !foundList; ) + for ( Iterator i = keys.iterator(); i.hasNext() && !foundList; ) { - String key = (String) i.next(); + String key = i.next(); // a little aggressive with the repositoryScanning and databaseScanning - should be no need to split // that configuration @@ -208,9 +208,9 @@ public class DefaultArchivaConfiguration } // escape all cron expressions to handle ',' - for ( Iterator i = configuration.getManagedRepositories().iterator(); i.hasNext(); ) + for ( Iterator i = configuration.getManagedRepositories().iterator(); i.hasNext(); ) { - ManagedRepositoryConfiguration c = (ManagedRepositoryConfiguration) i.next(); + ManagedRepositoryConfiguration c = i.next(); c.setRefreshCronExpression( escapeCronExpression( c.getRefreshCronExpression() ) ); } @@ -244,9 +244,9 @@ public class DefaultArchivaConfiguration { ( (Initializable) registry ).initialize(); - for ( Iterator i = listeners.iterator(); i.hasNext(); ) + for ( Iterator i = listeners.iterator(); i.hasNext(); ) { - RegistryListener l = (RegistryListener) i.next(); + RegistryListener l = i.next(); addRegistryChangeListener( l ); } @@ -319,9 +319,9 @@ public class DefaultArchivaConfiguration private Configuration processExpressions( Configuration config ) { // TODO: for commons-configuration 1.3 only - for ( Iterator i = config.getManagedRepositories().iterator(); i.hasNext(); ) + for ( Iterator i = config.getManagedRepositories().iterator(); i.hasNext(); ) { - ManagedRepositoryConfiguration c = (ManagedRepositoryConfiguration) i.next(); + ManagedRepositoryConfiguration c = i.next(); c.setLocation( removeExpressions( c.getLocation() ) ); c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) ); } diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java index a1684681b..51bdd11d2 100644 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java @@ -64,7 +64,7 @@ public class FileTypes /** * Map of default values for the file types. */ - private Map defaultTypeMap = new HashMap(); + private Map> defaultTypeMap = new HashMap>(); /** *

@@ -83,7 +83,7 @@ public class FileTypes * @param id the id to lookup. * @return the list of patterns. */ - public List getFileTypePatterns( String id ) + public List getFileTypePatterns( String id ) { Configuration config = archivaConfiguration.getConfiguration(); Predicate selectedFiletype = new FiletypeSelectionPredicate( id ); @@ -95,7 +95,7 @@ public class FileTypes return filetype.getPatterns(); } - List defaultPatterns = (List) defaultTypeMap.get( id ); + List defaultPatterns = defaultTypeMap.get( id ); if ( CollectionUtils.isEmpty( defaultPatterns ) ) { @@ -116,7 +116,7 @@ public class FileTypes .getResource( "/org/apache/maven/archiva/configuration/default-archiva.xml" ); XMLReader reader = new XMLReader( "configuration", defaultArchivaXml ); - List resp = reader.getElementList( "//configuration/repositoryScanning/fileTypes/fileType" ); + List resp = reader.getElementList( "//configuration/repositoryScanning/fileTypes/fileType" ); CollectionUtils.forAllDo( resp, new AddFileTypeToDefaultMap() ); } @@ -152,11 +152,11 @@ public class FileTypes return; } - List patternElemList = patternsElem.elements( "pattern" ); + List patternElemList = patternsElem.elements( "pattern" ); ElementTextListClosure elemTextList = new ElementTextListClosure(); CollectionUtils.forAllDo( patternElemList, elemTextList ); - List patterns = elemTextList.getList(); + List patterns = elemTextList.getList(); defaultTypeMap.put( id, patterns ); } diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java index 4429c1000..33fdb51b3 100644 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoader.java @@ -113,6 +113,7 @@ public class MavenProxyPropertyLoader } } + @SuppressWarnings("unchecked") private Properties getSubset( Properties props, String prefix ) { Enumeration keys = props.keys(); diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java index 7a6422463..96f15ab2a 100644 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/FiletypeToMapClosure.java @@ -34,7 +34,7 @@ import java.util.Map; public class FiletypeToMapClosure implements Closure { - private Map map = new HashMap(); + private Map map = new HashMap(); public void execute( Object input ) { @@ -45,7 +45,7 @@ public class FiletypeToMapClosure } } - public Map getMap() + public Map getMap() { return map; } diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java index d19b022dd..aebc924ba 100644 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/NetworkProxyComparator.java @@ -30,10 +30,9 @@ import java.util.Comparator; * @version $Id$ */ public class NetworkProxyComparator - implements Comparator + implements Comparator { - - public int compare( Object o1, Object o2 ) + public int compare( NetworkProxyConfiguration o1, NetworkProxyConfiguration o2 ) { if ( o1 == null && o2 == null ) { @@ -50,13 +49,8 @@ public class NetworkProxyComparator return -1; } - if ( ( o1 instanceof NetworkProxyConfiguration ) && ( o2 instanceof NetworkProxyConfiguration ) ) - { - String id1 = ( (NetworkProxyConfiguration) o1 ).getId(); - String id2 = ( (NetworkProxyConfiguration) o2 ).getId(); - return id1.compareToIgnoreCase( id2 ); - } - - return 0; + String id1 = o1.getId(); + String id2 = o2.getId(); + return id1.compareToIgnoreCase( id2 ); } }