Author: oheger Date: Wed Aug 3 20:23:17 2011 New Revision: 1153643 URL: http://svn.apache.org/viewvc?rev=1153643&view=rev Log: [CONFIGURATION-455] Improvements of lINIConfiguration.getSection(). Ported changes to branch. Modified: commons/proper/configuration/branches/configuration2_experimental/src/changes/changes.xml commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestINIConfiguration.java Modified: commons/proper/configuration/branches/configuration2_experimental/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/changes/changes.xml?rev=1153643&r1=1153642&r2=1153643&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/changes/changes.xml (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/changes/changes.xml Wed Aug 3 20:23:17 2011 @@ -84,6 +84,11 @@ clear() method. This is more efficient and also solves some other problems related to clearing a SubnodeConfiguration. + + HierarchicalINIConfiguration.getSection() now creates a section if it + does not exist. The SubnodeConfiguration returned by this method is now + always connected to the parent ini configuration. + XPathExpressionEngine now provides better support for the setProperty() method. Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java?rev=1153643&r1=1153642&r2=1153643&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java Wed Aug 3 20:23:17 2011 @@ -87,8 +87,10 @@ import org.apache.commons.lang3.StringUt * '=' to separate keys and values in parameters, for example * var1 : foo. *
  • Duplicate sections: Typically duplicate sections are not allowed, - * this configuration does however support it. In the event of a duplicate - * section, the two section's values are merged.
  • + * this configuration does however support this feature. In the event of a duplicate + * section, the two section's values are merged so that there is only a single + * section. Note: This also affects the internal data of the + * configuration. If it is saved, only a single section is written! *
  • Duplicate parameters: Typically duplicate parameters are only * allowed if they are in two different sections, thus they are local to * sections; this configuration simply merges duplicates; if a section has a @@ -177,7 +179,10 @@ import org.apache.commons.lang3.StringUt * also use other methods of {@link InMemoryConfiguration} for querying or * manipulating the hierarchy of configuration nodes, for instance the * {@code configurationAt()} method for obtaining the data of a specific - * section. + * section. However, be careful that the storage scheme described above is not + * violated (e.g. by adding multiple levels of nodes or inserting duplicate + * section nodes). Otherwise, the special methods for ini configurations may not + * work correctly! *

    *

    * The set of sections in this configuration can be retrieved using the @@ -721,13 +726,18 @@ public class INIConfiguration extends Ab * Returns a configuration with the content of the specified section. This * provides an easy way of working with a single section only. The way this * configuration is structured internally, this method is very similar to - * calling - * {@link AbstractHierarchicalConfiguration#configurationAt(String)} + * calling {@link AbstractHierarchicalConfiguration#configurationAt(String)} * with the name of the section in question. There are the following * differences however: *