mirror of https://github.com/apache/maven.git
Code cleanup - Maven requires Java 5+ : Replace for and while loops by for each
This commit is contained in:
parent
1f84f8f296
commit
d92746dc25
|
@ -141,9 +141,9 @@ public class DefaultProfileManager
|
|||
*/
|
||||
public void explicitlyActivate( List profileIds )
|
||||
{
|
||||
for ( Iterator it = profileIds.iterator(); it.hasNext(); )
|
||||
for ( Object profileId1 : profileIds )
|
||||
{
|
||||
String profileId = (String) it.next();
|
||||
String profileId = (String) profileId1;
|
||||
|
||||
explicitlyActivate( profileId );
|
||||
}
|
||||
|
@ -167,9 +167,9 @@ public class DefaultProfileManager
|
|||
*/
|
||||
public void explicitlyDeactivate( List profileIds )
|
||||
{
|
||||
for ( Iterator it = profileIds.iterator(); it.hasNext(); )
|
||||
for ( Object profileId1 : profileIds )
|
||||
{
|
||||
String profileId = (String) it.next();
|
||||
String profileId = (String) profileId1;
|
||||
|
||||
explicitlyDeactivate( profileId );
|
||||
}
|
||||
|
@ -215,9 +215,9 @@ public class DefaultProfileManager
|
|||
*/
|
||||
public void addProfiles( List profiles )
|
||||
{
|
||||
for ( Iterator it = profiles.iterator(); it.hasNext(); )
|
||||
for ( Object profile1 : profiles )
|
||||
{
|
||||
Profile profile = (Profile) it.next();
|
||||
Profile profile = (Profile) profile1;
|
||||
|
||||
addProfile( profile );
|
||||
}
|
||||
|
|
|
@ -100,21 +100,19 @@ public class ProfilesConversionUtils
|
|||
List repos = profileXmlProfile.getRepositories();
|
||||
if ( repos != null )
|
||||
{
|
||||
for ( Iterator it = repos.iterator(); it.hasNext(); )
|
||||
for ( Object repo : repos )
|
||||
{
|
||||
profile
|
||||
.addRepository(
|
||||
convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) it.next() ) );
|
||||
profile.addRepository( convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) repo ) );
|
||||
}
|
||||
}
|
||||
|
||||
List pluginRepos = profileXmlProfile.getPluginRepositories();
|
||||
if ( pluginRepos != null )
|
||||
{
|
||||
for ( Iterator it = pluginRepos.iterator(); it.hasNext(); )
|
||||
for ( Object pluginRepo : pluginRepos )
|
||||
{
|
||||
profile.addPluginRepository( convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) it
|
||||
.next() ) );
|
||||
profile.addPluginRepository(
|
||||
convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) pluginRepo ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -323,15 +323,13 @@ public class DefaultModelInheritanceAssembler
|
|||
List<Dependency> childDeps = childDepMgmt.getDependencies();
|
||||
|
||||
Map<String, Dependency> mappedChildDeps = new TreeMap<String, Dependency>();
|
||||
for ( Iterator<Dependency> it = childDeps.iterator(); it.hasNext(); )
|
||||
for ( Dependency dep : childDeps )
|
||||
{
|
||||
Dependency dep = it.next();
|
||||
mappedChildDeps.put( dep.getManagementKey(), dep );
|
||||
}
|
||||
|
||||
for ( Iterator<Dependency> it = parentDepMgmt.getDependencies().iterator(); it.hasNext(); )
|
||||
for ( Dependency dep : parentDepMgmt.getDependencies() )
|
||||
{
|
||||
Dependency dep = it.next();
|
||||
if ( !mappedChildDeps.containsKey( dep.getManagementKey() ) )
|
||||
{
|
||||
childDepMgmt.addDependency( dep );
|
||||
|
@ -382,14 +380,13 @@ public class DefaultModelInheritanceAssembler
|
|||
|
||||
Map childPlugins = child.getReportPluginsAsMap();
|
||||
|
||||
for ( Iterator it = parentPlugins.iterator(); it.hasNext(); )
|
||||
for ( Object parentPlugin1 : parentPlugins )
|
||||
{
|
||||
ReportPlugin parentPlugin = (ReportPlugin) it.next();
|
||||
ReportPlugin parentPlugin = (ReportPlugin) parentPlugin1;
|
||||
|
||||
String parentInherited = parentPlugin.getInherited();
|
||||
|
||||
if ( !handleAsInheritance || ( parentInherited == null )
|
||||
|| Boolean.valueOf( parentInherited ) )
|
||||
if ( !handleAsInheritance || ( parentInherited == null ) || Boolean.valueOf( parentInherited ) )
|
||||
{
|
||||
|
||||
ReportPlugin assembledPlugin = parentPlugin;
|
||||
|
|
|
@ -168,33 +168,35 @@ public class StringSearchModelInterpolator
|
|||
fieldsByClass.put( cls, fields );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < fields.length; i++ )
|
||||
for ( Field field : fields )
|
||||
{
|
||||
Class<?> type = fields[i].getType();
|
||||
if ( isQualifiedForInterpolation( fields[i], type ) )
|
||||
Class<?> type = field.getType();
|
||||
if ( isQualifiedForInterpolation( field, type ) )
|
||||
{
|
||||
boolean isAccessible = fields[i].isAccessible();
|
||||
fields[i].setAccessible( true );
|
||||
boolean isAccessible = field.isAccessible();
|
||||
field.setAccessible( true );
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( String.class == type )
|
||||
{
|
||||
String value = (String) fields[i].get( target );
|
||||
String value = (String) field.get( target );
|
||||
if ( value != null )
|
||||
{
|
||||
String interpolated = modelInterpolator.interpolateInternal( value, valueSources, postProcessors, debugEnabled );
|
||||
String interpolated =
|
||||
modelInterpolator.interpolateInternal( value, valueSources, postProcessors,
|
||||
debugEnabled );
|
||||
|
||||
if ( !interpolated.equals( value ) )
|
||||
{
|
||||
fields[i].set( target, interpolated );
|
||||
field.set( target, interpolated );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( Collection.class.isAssignableFrom( type ) )
|
||||
{
|
||||
Collection<Object> c = (Collection<Object>) fields[i].get( target );
|
||||
Collection<Object> c = (Collection<Object>) field.get( target );
|
||||
if ( c != null && !c.isEmpty() )
|
||||
{
|
||||
List<Object> originalValues = new ArrayList<Object>( c );
|
||||
|
@ -206,8 +208,9 @@ public class StringSearchModelInterpolator
|
|||
{
|
||||
if ( debugEnabled && logger != null )
|
||||
{
|
||||
logger.debug( "Skipping interpolation of field: " + fields[i] + " in: "
|
||||
+ cls.getName() + "; it is an unmodifiable collection." );
|
||||
logger.debug( "Skipping interpolation of field: " + field + " in: "
|
||||
+ cls.getName()
|
||||
+ "; it is an unmodifiable collection." );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -256,7 +259,7 @@ public class StringSearchModelInterpolator
|
|||
}
|
||||
else if ( Map.class.isAssignableFrom( type ) )
|
||||
{
|
||||
Map<Object, Object> m = (Map<Object, Object>) fields[i].get( target );
|
||||
Map<Object, Object> m = (Map<Object, Object>) field.get( target );
|
||||
if ( m != null && !m.isEmpty() )
|
||||
{
|
||||
for ( Map.Entry<Object, Object> entry : m.entrySet() )
|
||||
|
@ -283,8 +286,9 @@ public class StringSearchModelInterpolator
|
|||
{
|
||||
if ( debugEnabled && logger != null )
|
||||
{
|
||||
logger.debug( "Skipping interpolation of field: "
|
||||
+ fields[i] + " (key: " + entry.getKey() + ") in: "
|
||||
logger.debug(
|
||||
"Skipping interpolation of field: " + field
|
||||
+ " (key: " + entry.getKey() + ") in: "
|
||||
+ cls.getName()
|
||||
+ "; it is an unmodifiable collection." );
|
||||
}
|
||||
|
@ -308,10 +312,10 @@ public class StringSearchModelInterpolator
|
|||
}
|
||||
else
|
||||
{
|
||||
Object value = fields[i].get( target );
|
||||
Object value = field.get( target );
|
||||
if ( value != null )
|
||||
{
|
||||
if ( fields[i].getType().isArray() )
|
||||
if ( field.getType().isArray() )
|
||||
{
|
||||
evaluateArray( value );
|
||||
}
|
||||
|
@ -324,18 +328,18 @@ public class StringSearchModelInterpolator
|
|||
}
|
||||
catch ( IllegalArgumentException e )
|
||||
{
|
||||
throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i]
|
||||
+ " on class: " + cls.getName(), e );
|
||||
throw new ModelInterpolationException(
|
||||
"Failed to interpolate field: " + field + " on class: " + cls.getName(), e );
|
||||
}
|
||||
catch ( IllegalAccessException e )
|
||||
{
|
||||
throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i]
|
||||
+ " on class: " + cls.getName(), e );
|
||||
throw new ModelInterpolationException(
|
||||
"Failed to interpolate field: " + field + " on class: " + cls.getName(), e );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
fields[i].setAccessible( isAccessible );
|
||||
field.setAccessible( isAccessible );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,9 +125,9 @@ public class DefaultPathTranslator
|
|||
if ( s != null )
|
||||
{
|
||||
String basedirExpr = null;
|
||||
for ( int i = 0; i < BASEDIR_EXPRESSIONS.length; i++ )
|
||||
for ( String BASEDIR_EXPRESSION : BASEDIR_EXPRESSIONS )
|
||||
{
|
||||
basedirExpr = BASEDIR_EXPRESSIONS[i];
|
||||
basedirExpr = BASEDIR_EXPRESSION;
|
||||
if ( s.startsWith( basedirExpr ) )
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -55,13 +55,13 @@ public class ExpressionDocumenter
|
|||
|
||||
ClassLoader docLoader = initializeDocLoader();
|
||||
|
||||
for ( int i = 0; i < EXPRESSION_ROOTS.length; i++ )
|
||||
for ( String EXPRESSION_ROOT : EXPRESSION_ROOTS )
|
||||
{
|
||||
InputStream docStream = null;
|
||||
try
|
||||
{
|
||||
docStream = docLoader
|
||||
.getResourceAsStream( EXPRESSION_DOCO_ROOTPATH + EXPRESSION_ROOTS[i] + ".paramdoc.xml" );
|
||||
docStream =
|
||||
docLoader.getResourceAsStream( EXPRESSION_DOCO_ROOTPATH + EXPRESSION_ROOT + ".paramdoc.xml" );
|
||||
|
||||
if ( docStream != null )
|
||||
{
|
||||
|
@ -72,13 +72,13 @@ public class ExpressionDocumenter
|
|||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ExpressionDocumentationException( "Failed to read documentation for expression root: "
|
||||
+ EXPRESSION_ROOTS[i], e );
|
||||
throw new ExpressionDocumentationException(
|
||||
"Failed to read documentation for expression root: " + EXPRESSION_ROOT, e );
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new ExpressionDocumentationException( "Failed to parse documentation for expression root: "
|
||||
+ EXPRESSION_ROOTS[i], e );
|
||||
throw new ExpressionDocumentationException(
|
||||
"Failed to parse documentation for expression root: " + EXPRESSION_ROOT, e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -130,9 +130,9 @@ public class ExpressionDocumenter
|
|||
|
||||
if ( expressions != null && !expressions.isEmpty() )
|
||||
{
|
||||
for ( Iterator it = expressions.iterator(); it.hasNext(); )
|
||||
for ( Object expression : expressions )
|
||||
{
|
||||
Expression expr = (Expression) it.next();
|
||||
Expression expr = (Expression) expression;
|
||||
|
||||
bySyntax.put( expr.getSyntax(), expr );
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ public class MockManager
|
|||
|
||||
public void replayAll()
|
||||
{
|
||||
for ( Iterator it = mockControls.iterator(); it.hasNext(); )
|
||||
for ( Object mockControl : mockControls )
|
||||
{
|
||||
MockControl control = ( MockControl ) it.next();
|
||||
MockControl control = (MockControl) mockControl;
|
||||
|
||||
control.replay();
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ public class MockManager
|
|||
|
||||
public void verifyAll()
|
||||
{
|
||||
for ( Iterator it = mockControls.iterator(); it.hasNext(); )
|
||||
for ( Object mockControl : mockControls )
|
||||
{
|
||||
MockControl control = ( MockControl ) it.next();
|
||||
MockControl control = (MockControl) mockControl;
|
||||
|
||||
control.verify();
|
||||
}
|
||||
|
|
|
@ -157,9 +157,9 @@ public class ModelUtilsTest
|
|||
|
||||
if( configuration != null )
|
||||
{
|
||||
for ( Iterator it = configuration.entrySet().iterator(); it.hasNext(); )
|
||||
for ( Object o : configuration.entrySet() )
|
||||
{
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
Map.Entry entry = (Map.Entry) o;
|
||||
|
||||
Xpp3Dom param = new Xpp3Dom( String.valueOf( entry.getKey() ) );
|
||||
param.setValue( String.valueOf( entry.getValue() ) );
|
||||
|
|
|
@ -133,9 +133,8 @@ public class ProjectClasspathTest
|
|||
private Artifact getArtifact( MavenProject project, String groupId, String artifactId )
|
||||
{
|
||||
System.out.println( "[ Looking for " + groupId + ":" + artifactId + " ]" );
|
||||
for ( Iterator<Artifact> i = project.getArtifacts().iterator(); i.hasNext(); )
|
||||
for ( Artifact a : project.getArtifacts() )
|
||||
{
|
||||
Artifact a = i.next();
|
||||
System.out.println( a.toString() );
|
||||
if ( artifactId.equals( a.getArtifactId() ) && a.getGroupId().equals( groupId ) )
|
||||
{
|
||||
|
|
|
@ -70,12 +70,14 @@ public class ProjectInheritanceTest
|
|||
assertTrue( "No Artifacts", set.size() > 0 );
|
||||
assertTrue( "Set size should be 3, is " + set.size(), set.size() == 3 );
|
||||
|
||||
Iterator iter = set.iterator();
|
||||
while ( iter.hasNext() )
|
||||
for ( Object aSet : set )
|
||||
{
|
||||
Artifact artifact = (Artifact) iter.next();
|
||||
System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion()
|
||||
+ " Optional=" + ( artifact.isOptional() ? "true" : "false" ) );
|
||||
Artifact artifact = (Artifact) aSet;
|
||||
System.out.println(
|
||||
"Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Optional=" + (
|
||||
artifact.isOptional()
|
||||
? "true"
|
||||
: "false" ) );
|
||||
assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(),
|
||||
artifact.getVersion().equals( "1.0" ) );
|
||||
}
|
||||
|
|
|
@ -64,14 +64,15 @@ public class ProjectInheritanceTest
|
|||
Set set = project1.getArtifacts();
|
||||
assertNotNull( "No artifacts", set );
|
||||
assertTrue( "No Artifacts", set.size() > 0 );
|
||||
Iterator iter = set.iterator();
|
||||
|
||||
while ( iter.hasNext() )
|
||||
for ( Object aSet : set )
|
||||
{
|
||||
Artifact artifact = (Artifact) iter.next();
|
||||
System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " "
|
||||
+ artifact.getVersion() + " Scope: " + artifact.getScope() );
|
||||
assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), artifact.getVersion().equals( "1.0" ) );
|
||||
Artifact artifact = (Artifact) aSet;
|
||||
System.out.println(
|
||||
"Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Scope: "
|
||||
+ artifact.getScope() );
|
||||
assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(),
|
||||
artifact.getVersion().equals( "1.0" ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,14 +66,17 @@ public class ProjectInheritanceTest
|
|||
assertTrue("No Artifacts", set.size() > 0);
|
||||
assertTrue("Set size should be 3, is " + set.size(), set.size() == 3 );
|
||||
|
||||
Iterator iter = set.iterator();
|
||||
|
||||
while (iter.hasNext())
|
||||
for ( Object aSet : set )
|
||||
{
|
||||
Artifact artifact = (Artifact)iter.next();
|
||||
Artifact artifact = (Artifact) aSet;
|
||||
assertFalse( "", artifact.getArtifactId().equals( "t07-d" ) );
|
||||
System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Optional=" + (artifact.isOptional() ? "true" : "false"));
|
||||
assertTrue("Incorrect version for " + artifact.getDependencyConflictId(), artifact.getVersion().equals("1.0"));
|
||||
System.out.println(
|
||||
"Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Optional=" + (
|
||||
artifact.isOptional()
|
||||
? "true"
|
||||
: "false" ) );
|
||||
assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(),
|
||||
artifact.getVersion().equals( "1.0" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -719,9 +719,9 @@ public class DefaultArtifactCollectorTest
|
|||
|
||||
private Artifact getArtifact( String id, Set artifacts )
|
||||
{
|
||||
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
|
||||
for ( Object artifact : artifacts )
|
||||
{
|
||||
Artifact a = (Artifact) i.next();
|
||||
Artifact a = (Artifact) artifact;
|
||||
if ( a.getArtifactId().equals( id ) && a.getGroupId().equals( GROUP_ID ) )
|
||||
{
|
||||
return a;
|
||||
|
@ -886,9 +886,9 @@ public class DefaultArtifactCollectorTest
|
|||
{
|
||||
Set projectArtifacts = new HashSet();
|
||||
|
||||
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
|
||||
for ( Object dependency : dependencies )
|
||||
{
|
||||
Artifact d = (Artifact) i.next();
|
||||
Artifact d = (Artifact) dependency;
|
||||
|
||||
VersionRange versionRange;
|
||||
if ( d.getVersionRange() != null )
|
||||
|
@ -904,8 +904,8 @@ public class DefaultArtifactCollectorTest
|
|||
{
|
||||
/* don't call createDependencyArtifact as it'll ignore test and provided scopes */
|
||||
artifact =
|
||||
artifactFactory.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(),
|
||||
d.getScope(), d.getType() );
|
||||
artifactFactory.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getScope(),
|
||||
d.getType() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -127,12 +127,12 @@ public class ReactorManager
|
|||
|
||||
if ( dependents != null && !dependents.isEmpty() )
|
||||
{
|
||||
for ( Iterator it = dependents.iterator(); it.hasNext(); )
|
||||
for ( Object dependent : dependents )
|
||||
{
|
||||
String dependentId = (String) it.next();
|
||||
String dependentId = (String) dependent;
|
||||
|
||||
if ( !buildSuccessesByProject.containsKey( dependentId )
|
||||
&& !buildFailuresByProject.containsKey( dependentId ) )
|
||||
if ( !buildSuccessesByProject.containsKey( dependentId ) && !buildFailuresByProject.containsKey(
|
||||
dependentId ) )
|
||||
{
|
||||
blackList( dependentId );
|
||||
}
|
||||
|
|
|
@ -110,18 +110,16 @@ public class DefaultLifecycleBindingsInjector
|
|||
|
||||
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
|
||||
|
||||
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
|
||||
for ( Plugin element : tgt )
|
||||
{
|
||||
Plugin element = it.next();
|
||||
Object key = getPluginKey( element );
|
||||
merged.put( key, element );
|
||||
}
|
||||
|
||||
Map<Object, Plugin> unmanaged = new LinkedHashMap<Object, Plugin>();
|
||||
|
||||
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
|
||||
for ( Plugin element : src )
|
||||
{
|
||||
Plugin element = it.next();
|
||||
Object key = getPluginKey( element );
|
||||
Plugin existing = merged.get( key );
|
||||
if ( existing != null )
|
||||
|
@ -140,9 +138,8 @@ public class DefaultLifecycleBindingsInjector
|
|||
PluginManagement pluginMgmt = (PluginManagement) context.get( PLUGIN_MANAGEMENT );
|
||||
if ( pluginMgmt != null )
|
||||
{
|
||||
for ( Iterator<Plugin> it = pluginMgmt.getPlugins().iterator(); it.hasNext(); )
|
||||
for ( Plugin managedPlugin : pluginMgmt.getPlugins() )
|
||||
{
|
||||
Plugin managedPlugin = it.next();
|
||||
Object key = getPluginKey( managedPlugin );
|
||||
Plugin unmanagedPlugin = unmanaged.get( key );
|
||||
if ( unmanagedPlugin != null )
|
||||
|
|
|
@ -291,9 +291,8 @@ public class MavenProject
|
|||
List<String> modules = getModules();
|
||||
if ( modules != null )
|
||||
{
|
||||
for ( Iterator<String> it = modules.iterator(); it.hasNext(); )
|
||||
for ( String modulePath : modules )
|
||||
{
|
||||
String modulePath = it.next();
|
||||
String moduleName = modulePath;
|
||||
|
||||
if ( moduleName.endsWith( "/" ) || moduleName.endsWith( "\\" ) )
|
||||
|
@ -1248,10 +1247,8 @@ public class MavenProject
|
|||
List<Extension> extensions = getBuildExtensions();
|
||||
if ( extensions != null )
|
||||
{
|
||||
for ( Iterator<Extension> i = extensions.iterator(); i.hasNext(); )
|
||||
for ( Extension ext : extensions )
|
||||
{
|
||||
Extension ext = i.next();
|
||||
|
||||
String version;
|
||||
if ( StringUtils.isEmpty( ext.getVersion() ) )
|
||||
{
|
||||
|
@ -1262,7 +1259,8 @@ public class MavenProject
|
|||
version = ext.getVersion();
|
||||
}
|
||||
|
||||
Artifact artifact = repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" );
|
||||
Artifact artifact =
|
||||
repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" );
|
||||
|
||||
if ( artifact != null )
|
||||
{
|
||||
|
@ -1556,10 +1554,8 @@ public class MavenProject
|
|||
|
||||
if ( getReportPlugins() != null )
|
||||
{
|
||||
for ( Iterator<ReportPlugin> iterator = getReportPlugins().iterator(); iterator.hasNext(); )
|
||||
for ( ReportPlugin plugin : getReportPlugins() )
|
||||
{
|
||||
ReportPlugin plugin = iterator.next();
|
||||
|
||||
if ( pluginGroupId.equals( plugin.getGroupId() ) && pluginArtifactId.equals( plugin.getArtifactId() ) )
|
||||
{
|
||||
dom = (Xpp3Dom) plugin.getConfiguration();
|
||||
|
@ -1668,10 +1664,8 @@ public class MavenProject
|
|||
if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) && ( deps.size() > 0 ) )
|
||||
{
|
||||
map = new HashMap<String, Artifact>();
|
||||
for ( Iterator<Dependency> i = dependencyManagement.getDependencies().iterator(); i.hasNext(); )
|
||||
for ( Dependency d : dependencyManagement.getDependencies() )
|
||||
{
|
||||
Dependency d = i.next();
|
||||
|
||||
Artifact artifact = repositorySystem.createDependencyArtifact( d );
|
||||
|
||||
if ( artifact == null )
|
||||
|
|
|
@ -78,23 +78,22 @@ public class DefaultJavaToolchainFactory
|
|||
//TODO possibly move at least parts to a utility method or abstract implementation.
|
||||
dom = (Xpp3Dom) model.getProvides();
|
||||
Xpp3Dom[] provides = dom.getChildren();
|
||||
for ( int i = 0; i < provides.length; i++ )
|
||||
for ( Xpp3Dom provide : provides )
|
||||
{
|
||||
String key = provides[i].getName();
|
||||
String value = provides[i].getValue();
|
||||
String key = provide.getName();
|
||||
String value = provide.getValue();
|
||||
if ( value == null )
|
||||
{
|
||||
throw new MisconfiguredToolchainException( "Provides token '" + key + "' doesn't have any value configured." );
|
||||
throw new MisconfiguredToolchainException(
|
||||
"Provides token '" + key + "' doesn't have any value configured." );
|
||||
}
|
||||
if ( "version".equals( key ) )
|
||||
{
|
||||
jtc.addProvideToken( key,
|
||||
RequirementMatcherFactory.createVersionMatcher( value ) );
|
||||
jtc.addProvideToken( key, RequirementMatcherFactory.createVersionMatcher( value ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
jtc.addProvideToken( key,
|
||||
RequirementMatcherFactory.createExactMatcher( value ) );
|
||||
jtc.addProvideToken( key, RequirementMatcherFactory.createExactMatcher( value ) );
|
||||
}
|
||||
}
|
||||
return jtc;
|
||||
|
|
|
@ -59,10 +59,8 @@ public class DefaultMavenProjectBuilderTest
|
|||
|
||||
if ( !filesToDelete.isEmpty() )
|
||||
{
|
||||
for ( Iterator<File> it = filesToDelete.iterator(); it.hasNext(); )
|
||||
for ( File file : filesToDelete )
|
||||
{
|
||||
File file = it.next();
|
||||
|
||||
if ( file.exists() )
|
||||
{
|
||||
if ( file.isDirectory() )
|
||||
|
|
|
@ -161,10 +161,8 @@ public class CLIManager
|
|||
|
||||
StringBuilder currentArg = null;
|
||||
|
||||
for ( int i = 0; i < args.length; i++ )
|
||||
for ( String arg : args )
|
||||
{
|
||||
String arg = args[i];
|
||||
|
||||
boolean addedToBuffer = false;
|
||||
|
||||
if ( arg.startsWith( "\"" ) )
|
||||
|
|
|
@ -865,9 +865,9 @@ public class MavenCli
|
|||
String[] profileOptionValues = commandLine.getOptionValues( CLIManager.ACTIVATE_PROFILES );
|
||||
if ( profileOptionValues != null )
|
||||
{
|
||||
for ( int i = 0; i < profileOptionValues.length; ++i )
|
||||
for ( String profileOptionValue : profileOptionValues )
|
||||
{
|
||||
StringTokenizer profileTokens = new StringTokenizer( profileOptionValues[i], "," );
|
||||
StringTokenizer profileTokens = new StringTokenizer( profileOptionValue, "," );
|
||||
|
||||
while ( profileTokens.hasMoreTokens() )
|
||||
{
|
||||
|
@ -978,9 +978,9 @@ public class MavenCli
|
|||
{
|
||||
String[] values = commandLine.getOptionValues( CLIManager.PROJECT_LIST );
|
||||
List<String> projects = new ArrayList<String>();
|
||||
for ( int i = 0; i < values.length; i++ )
|
||||
for ( String value : values )
|
||||
{
|
||||
String[] tmp = StringUtils.split( values[i], "," );
|
||||
String[] tmp = StringUtils.split( value, "," );
|
||||
projects.addAll( Arrays.asList( tmp ) );
|
||||
}
|
||||
request.setSelectedProjects( projects );
|
||||
|
@ -1076,9 +1076,9 @@ public class MavenCli
|
|||
|
||||
if ( defStrs != null )
|
||||
{
|
||||
for ( int i = 0; i < defStrs.length; ++i )
|
||||
for ( String defStr : defStrs )
|
||||
{
|
||||
setCliProperty( defStrs[i], userProperties );
|
||||
setCliProperty( defStr, userProperties );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue