You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/04/14 22:37:34 UTC
svn commit: r764944 -
/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
Author: bentmann
Date: Tue Apr 14 20:37:34 2009
New Revision: 764944
URL: http://svn.apache.org/viewvc?rev=764944&view=rev
Log:
o Fixed detection of default profiles
Modified:
maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java?rev=764944&r1=764943&r2=764944&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java Tue Apr 14 20:37:34 2009
@@ -36,8 +36,14 @@
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.MutablePlexusContainer;
-import java.util.*;
-import java.util.Map.Entry;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
public class DefaultProfileManager
implements ProfileManager
@@ -51,7 +57,7 @@
private static final ProfileMatcher defaultMatcher = new DefaultMatcher();
private static final List<ProfileMatcher> matchers =
- (List<ProfileMatcher>) Collections.unmodifiableList( Arrays.asList( new PropertyMatcher(), new FileMatcher(), new JdkMatcher() ) );
+ Collections.unmodifiableList( Arrays.asList( new PropertyMatcher(), new FileMatcher(), new JdkMatcher() ) );
/**
* the properties passed to the profile manager are the props that
@@ -109,7 +115,7 @@
{
String profileId = profile.getId();
- Profile existing = (Profile) profilesById.get( profileId );
+ Profile existing = profilesById.get( profileId );
if ( existing != null )
{
container.getLogger().warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() +
@@ -135,12 +141,10 @@
{
List<Profile> activeFromPom = new ArrayList<Profile>();
List<Profile> activeExternal = new ArrayList<Profile>();
- for ( Iterator it = profilesById.entrySet().iterator(); it.hasNext(); )
+ for ( Map.Entry<String, Profile> entry : profilesById.entrySet() )
{
- Map.Entry entry = (Entry) it.next();
-
- String profileId = (String) entry.getKey();
- Profile profile = (Profile) entry.getValue();
+ String profileId = entry.getKey();
+ Profile profile = entry.getValue();
if ( !profileActivationContext.isExplicitlyInactive( profileId )
&& (profileActivationContext.isExplicitlyActive( profileId ) || isActive( profile, profileActivationContext ) ) )
@@ -170,7 +174,7 @@
{
continue;
}
- Profile profile = (Profile) profilesById.get( profileId );
+ Profile profile = profilesById.get( profileId );
if ( profile != null )
{
@@ -266,10 +270,8 @@
*/
public void addProfiles( List<Profile> profiles )
{
- for ( Iterator it = profiles.iterator(); it.hasNext(); )
+ for ( Profile profile : profiles )
{
- Profile profile = (Profile) it.next();
-
addProfile( profile );
}
}
@@ -279,7 +281,7 @@
List<Profile> defaults = new ArrayList<Profile>();
for(Profile p : profiles)
{
- if( (p.getActivation() != null && p.getActivation().isActiveByDefault()) || p.getActivation() == null )
+ if ( p.getActivation() != null && p.getActivation().isActiveByDefault() )
{
defaults.add( p );
}
@@ -310,7 +312,7 @@
private void activateAsDefault( String profileId )
{
- List defaultIds = profileActivationContext.getActiveByDefaultProfileIds();
+ List<String> defaultIds = profileActivationContext.getActiveByDefaultProfileIds();
if ( !defaultIds.contains( profileId ) )
{