From 86ccde354988171d1e87ce1f2b543de3b9b73b6d Mon Sep 17 00:00:00 2001 From: Herve Boutemy Date: Sat, 15 Aug 2009 22:17:35 +0000 Subject: [PATCH] use Java 5 generics git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@804536 13f79535-47bb-0310-9956-ffa450edef68 --- .../validation/DefaultSettingsValidator.java | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java b/maven-core/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java index 188229b538..35d8d4a9c1 100644 --- a/maven-core/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java +++ b/maven-core/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java @@ -19,7 +19,6 @@ package org.apache.maven.settings.validation; * under the License. */ -import java.util.Iterator; import java.util.List; import org.apache.maven.settings.Profile; @@ -37,28 +36,24 @@ public class DefaultSettingsValidator public SettingsValidationResult validate( Settings model ) { SettingsValidationResult result = new SettingsValidationResult(); - - List profiles = model.getProfiles(); - if (profiles != null) { - Iterator it = profiles.iterator(); - while (it.hasNext()) { - Profile prof = (Profile)it.next(); + + List profiles = model.getProfiles(); + if ( profiles != null ) + { + for (Profile prof : profiles ) + { validateRepositories( result, prof.getRepositories(), "repositories.repository" ); validateRepositories( result, prof.getPluginRepositories(), "pluginRepositories.pluginRepository" ); } - } - return result; } - private void validateRepositories( SettingsValidationResult result, List repositories, String prefix ) + private void validateRepositories( SettingsValidationResult result, List repositories, String prefix ) { - for ( Iterator it = repositories.iterator(); it.hasNext(); ) + for ( Repository repository : repositories ) { - Repository repository = (Repository) it.next(); - validateStringNotEmpty( prefix + ".id", result, repository.getId() ); validateStringNotEmpty( prefix + ".url", result, repository.getUrl() ); @@ -106,7 +101,6 @@ public class DefaultSettingsValidator result.addMessage( "'" + fieldName + "' is missing." ); } - return false; }