From bd988544818cbacb1900b84c5fe1556f4ecf2e02 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Gonzalez Date: Fri, 7 Jul 2006 12:46:49 +0000 Subject: [PATCH] Remove unused method, consolidate if blocks git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@419885 13f79535-47bb-0310-9956-ffa450edef68 --- .../settings/DefaultMavenSettingsBuilder.java | 50 ++----------------- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java b/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java index 56975b6166..073525a449 100644 --- a/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java +++ b/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java @@ -134,55 +134,11 @@ public class DefaultMavenSettingsBuilder for ( Iterator profiles = settings.getProfiles().iterator(); profiles.hasNext(); ) { Profile profile = (Profile) profiles.next(); - if ( profile.getActivation() != null && profile.getActivation().isActiveByDefault() ) + if ( profile.getActivation() != null && profile.getActivation().isActiveByDefault() + && !activeProfiles.contains( profile.getId() ) ) { - if ( !activeProfiles.contains( profile.getId() ) ) - { - settings.addActiveProfile( profile.getId() ); - } + settings.addActiveProfile( profile.getId() ); } } } - - private File getFile( String pathPattern, String basedirSysProp, String altLocationSysProp ) - { - // ------------------------------------------------------------------------------------- - // Alright, here's the justification for all the regexp wizardry below... - // - // Continuum and other server-like apps may need to locate the user-level and - // global-level settings somewhere other than ${user.home} and ${maven.home}, - // respectively. Using a simple replacement of these patterns will allow them - // to specify the absolute path to these files in a customized components.xml - // file. Ideally, we'd do full pattern-evaluation against the sysprops, but this - // is a first step. There are several replacements below, in order to normalize - // the path character before we operate on the string as a regex input, and - // in order to avoid surprises with the File construction... - // ------------------------------------------------------------------------------------- - - String path = System.getProperty( altLocationSysProp ); - - if ( StringUtils.isEmpty( path ) ) - { - // TODO: This replacing shouldn't be necessary as user.home should be in the - // context of the container and thus the value would be interpolated by Plexus - String basedir = System.getProperty( basedirSysProp ); - if ( basedir == null ) - { - basedir = System.getProperty( "user.dir" ); - } - - basedir = basedir.replaceAll( "\\\\", "/" ); - basedir = basedir.replaceAll( "\\$", "\\\\\\$" ); - - path = pathPattern.replaceAll( "\\$\\{" + basedirSysProp + "\\}", basedir ); - path = path.replaceAll( "\\\\", "/" ); - path = path.replaceAll( "//", "/" ); - - return new File( path ).getAbsoluteFile(); - } - else - { - return new File( path ).getAbsoluteFile(); - } - } }