You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2008/01/24 17:51:35 UTC

svn commit: r614923 - /maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java

Author: jdcasey
Date: Thu Jan 24 08:51:34 2008
New Revision: 614923

URL: http://svn.apache.org/viewvc?rev=614923&view=rev
Log:
Add a little more safety for people passing in a null activation context.

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=614923&r1=614922&r2=614923&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 Thu Jan 24 08:51:34 2008
@@ -59,7 +59,14 @@
     public DefaultProfileManager( PlexusContainer container, ProfileActivationContext profileActivationContext )
     {
         this.container = container;
-        this.profileActivationContext = profileActivationContext;
+        if ( profileActivationContext == null )
+        {
+            this.profileActivationContext = createDefaultActivationContext();
+        }
+        else
+        {
+            this.profileActivationContext = profileActivationContext;
+        }
     }
 
     // TODO: Remove this, if possible. It uses system properties, which are not safe for IDE and other embedded environments.
@@ -70,11 +77,16 @@
     {
         this.container = container;
 
+        profileActivationContext = createDefaultActivationContext();
+    }
+
+    private ProfileActivationContext createDefaultActivationContext()
+    {
         // create the necessary bits to get a skeletal profile manager running.
         Logger logger = container.getLoggerManager().getLoggerForComponent( DefaultProfileManager.class.getName() );
         MavenRealmManager manager = new DefaultMavenRealmManager( container, logger );
 
-        profileActivationContext = new DefaultProfileActivationContext( manager, System.getProperties(), false );
+        return new DefaultProfileActivationContext( manager, System.getProperties(), false );
     }
 
     public ProfileActivationContext getProfileActivationContext()