Add a little more safety for people passing in a null activation context.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@614923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2008-01-24 16:51:34 +00:00
parent 48db18c81b
commit b7960dce75

View File

@ -59,7 +59,14 @@ public class DefaultProfileManager
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 @@ public DefaultProfileManager( PlexusContainer container )
{
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()