continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r594091 - /maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
Date Mon, 12 Nov 2007 12:07:46 GMT
Author: olamy
Date: Mon Nov 12 04:07:45 2007
New Revision: 594091

URL: http://svn.apache.org/viewvc?rev=594091&view=rev
Log:
fix ClassCastException

Modified:
    maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java

Modified: maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java?rev=594091&r1=594090&r2=594091&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
(original)
+++ maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
Mon Nov 12 04:07:45 2007
@@ -64,6 +64,7 @@
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 /**
@@ -349,23 +350,28 @@
         remoteRepositories.add(
             factory.createArtifactRepository( "central", "http://repo1.maven.org/maven2",
layout, null, null ) );
         //Load extra repositories from active profile
-        List<Profile> profiles = getSettings( container ).getActiveProfiles();
-        if ( profiles != null && !profiles.isEmpty() )
+        
+        Settings settings = getSettings( container );
+        List<String> profileIds = settings.getActiveProfiles();
+        List<Profile> profiles = settings.getProfiles();
+        Map<String, Profile> profilesAsMap = settings.getProfilesAsMap();
+        if ( profileIds != null && !profileIds.isEmpty() )
         {
-            for ( Profile p : profiles )
+            for ( String profileId : profileIds )
             {
-                List<Repository> repos = p.getRepositories();
+                Profile profile = profilesAsMap.get( profileId );
+                List<Repository> repos = profile.getRepositories();
                 if ( repos != null && !repos.isEmpty() )
                 {
                     for ( Repository repo : repos )
                     {
-                        remoteRepositories.add(
-                            factory.createArtifactRepository( repo.getId(), repo.getUrl(),
layout, null, null ) );
+                        remoteRepositories.add( factory.createArtifactRepository( repo.getId(),
repo
+                            .getUrl(), layout, null, null ) );
                     }
                 }
             }
         }
-
+        
         ArtifactFactory artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE
);
         Artifact artifact =
             artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME,
"jar" );



Mime
View raw message