commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r819402 - /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java
Date Sun, 27 Sep 2009 20:58:07 GMT
Author: rgoers
Date: Sun Sep 27 20:58:07 2009
New Revision: 819402

URL: http://svn.apache.org/viewvc?rev=819402&view=rev
Log:
Revert prior change. For some reason using ConfigurationUtils.copy() causes all sorts of problems
when DefaultConfigurationBuilder is performing this operation on JBoss.

Modified:
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java

Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java?rev=819402&r1=819401&r2=819402&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java
Sun Sep 27 20:58:07 2009
@@ -17,6 +17,11 @@
 
 package org.apache.commons.configuration;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Iterator;
+
 /**
  * A configuration based on the system properties.
  *
@@ -26,6 +31,7 @@
  */
 public class SystemConfiguration extends MapConfiguration
 {
+    private static Log log = LogFactory.getLog(SystemConfiguration.class);
     /**
      * Create a Configuration based on the system properties.
      *
@@ -38,7 +44,6 @@
 
     /**
      * The method allows system properties to be set from a property file.
-     * 
      * @param fileName The name of the property file.
      * @throws Exception if an error occurs.
      * @since 1.6
@@ -50,7 +55,6 @@
 
     /**
      * The method allows system properties to be set from a property file.
-     * 
      * @param basePath The base path to look for the property file.
      * @param fileName The name of the property file.
      * @throws Exception if an error occurs.
@@ -71,12 +75,21 @@
 
     /**
      * Set System properties from a configuration file.
-     * 
      * @param systemConfig The configuration containing the properties to be set.
      * @since 1.6
      */
     public static void setSystemProperties(PropertiesConfiguration systemConfig)
     {
-        ConfigurationUtils.copy(systemConfig, new SystemConfiguration());
+        Iterator iter = systemConfig.getKeys();
+        while (iter.hasNext())
+        {
+            String key = (String) iter.next();
+            String value = (String) systemConfig.getProperty(key);
+            if (log.isDebugEnabled())
+            {
+                log.debug("Setting system property " + key + " to " + value);
+            }
+            System.setProperty(key, value);
+        }
     }
 }



Mime
View raw message