maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r895249 - /maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
Date Sat, 02 Jan 2010 18:12:45 GMT
Author: bentmann
Date: Sat Jan  2 18:12:44 2010
New Revision: 895249

URL: http://svn.apache.org/viewvc?rev=895249&view=rev
Log:
o Optimized performance

Modified:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=895249&r1=895248&r2=895249&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
Sat Jan  2 18:12:44 2010
@@ -101,6 +101,8 @@
     @Requirement
     private LegacySupport legacySupport;
 
+    private static Properties envVars;
+
     private void injectSession( MetadataResolutionRequest request )
     {
         MavenSession session = legacySupport.getSession();
@@ -699,18 +701,25 @@
     {
         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() );
 



Mime
View raw message