Skip to content

Commit

Permalink
o Optimized performance
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@895249 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
bentmann committed Jan 2, 2010
1 parent afb40dc commit 1957ff0
Showing 1 changed file with 17 additions and 8 deletions.
Expand Up @@ -101,6 +101,8 @@ public class MavenMetadataSource
@Requirement
private LegacySupport legacySupport;

private static Properties envVars;

private void injectSession( MetadataResolutionRequest request )
{
MavenSession session = legacySupport.getSession();
Expand Down Expand Up @@ -699,18 +701,25 @@ private Properties getSystemProperties()
{
Properties props = new Properties();

try
if ( envVars == null )
{
Properties envVars = CommandLineUtils.getSystemEnvVars();
for ( Entry<Object, Object> e : envVars.entrySet() )
Properties tmp = new Properties();
try
{
Properties env = CommandLineUtils.getSystemEnvVars();
for ( Entry<Object, Object> e : env.entrySet() )
{
tmp.setProperty( "env." + e.getKey().toString(), e.getValue().toString() );
}
}
catch ( IOException e )
{
props.setProperty( "env." + e.getKey().toString(), e.getValue().toString() );
logger.debug( "Error getting environment variables: " + e );
}
envVars = tmp;
}
catch ( IOException e )
{
logger.debug( "Error getting environment variables: " + e );
}

props.putAll( envVars );

props.putAll( System.getProperties() );

Expand Down

0 comments on commit 1957ff0

Please sign in to comment.