You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2013/05/13 22:25:49 UTC

svn commit: r1482085 - in /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration: PropertiesConfiguration.java PropertiesConfigurationLayout.java

Author: oheger
Date: Mon May 13 20:25:48 2013
New Revision: 1482085

URL: http://svn.apache.org/r1482085
Log:
Use internal methods when loading and saving a PropertiesConfiguration instance.

This avoids that for each property to be loaded or saved the configuration's
synchronizer is invoked.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfiguration.java?rev=1482085&r1=1482084&r2=1482085&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfiguration.java Mon May 13 20:25:48 2013
@@ -451,7 +451,10 @@ public class PropertiesConfiguration ext
 
     /**
      * {@inheritDoc} This implementation delegates to the associated layout
-     * object which does the actual loading.
+     * object which does the actual loading. Note that this method does not
+     * do any synchronization. This lies in the responsibility of the caller.
+     * (Typically, the caller is a {@code FileHandler} object which takes
+     * care for proper synchronization.)
      *
      * @since 2.0
      */
@@ -462,7 +465,8 @@ public class PropertiesConfiguration ext
 
     /**
      * {@inheritDoc} This implementation delegates to the associated layout
-     * object which does the actual saving.
+     * object which does the actual saving. Note that, analogous to
+     * {@link #read(Reader)}, this method does not do any synchronization.
      *
      * @since 2.0
      */
@@ -532,7 +536,7 @@ public class PropertiesConfiguration ext
 
         else
         {
-            addProperty(key, value);
+            addPropertyInternal(key, value);
             result = true;
         }
 

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java?rev=1482085&r1=1482084&r2=1482085&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfigurationLayout.java Mon May 13 20:25:48 2013
@@ -570,7 +570,7 @@ public class PropertiesConfigurationLayo
 
             for (String key : layoutData.keySet())
             {
-                if (config.containsKey(key))
+                if (config.containsKeyInternal(key))
                 {
 
                     // Output blank lines before property
@@ -586,7 +586,7 @@ public class PropertiesConfigurationLayo
                     boolean singleLine = (isForceSingleLine() || isSingleLine(key))
                             && !config.isDelimiterParsingDisabled();
                     writer.setCurrentSeparator(getSeparator(key));
-                    writer.writeProperty(key, config.getProperty(
+                    writer.writeProperty(key, config.getPropertyInternal(
                             key), singleLine);
                 }
             }