commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r469268 - in /jakarta/commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/SubsetConfiguration.java src/test/org/apache/commons/configuration/TestBaseConfiguration.java xdocs/changes.xml
Date Mon, 30 Oct 2006 20:51:00 GMT
Author: oheger
Date: Mon Oct 30 12:50:59 2006
New Revision: 469268

URL: http://svn.apache.org/viewvc?view=rev&rev=469268
Log:
Updated SubsetConfiguration to support interpolation for non string values, too; fix for CONFIGURATION-235

Modified:
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestBaseConfiguration.java
    jakarta/commons/proper/configuration/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java?view=diff&rev=469268&r1=469267&r2=469268
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java
Mon Oct 30 12:50:59 2006
@@ -236,7 +236,7 @@
     /**
      * {@inheritDoc}
      */
-    protected String interpolate(String base)
+    protected Object interpolate(Object base)
     {
         if (delimiter == null && "".equals(prefix))
         {

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestBaseConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestBaseConfiguration.java?view=diff&rev=469268&r1=469267&r2=469268
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestBaseConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestBaseConfiguration.java
Mon Oct 30 12:50:59 2006
@@ -661,6 +661,19 @@
         fail("IllegalStateException should have been thrown for looped property references");
     }
 
+    /**
+     * Tests interpolation when a subset configuration is involved.
+     */
+    public void testInterpolationSubset()
+    {
+        config.addProperty("test.a", new Integer(42));
+        config.addProperty("test.b", "${test.a}");
+        assertEquals("Wrong interpolated value", 42, config.getInt("test.b"));
+        Configuration subset = config.subset("test");
+        assertEquals("Wrong string property", "42", subset.getString("b"));
+        assertEquals("Wrong int property", 42, subset.getInt("b"));
+    }
+
     public void testGetHexadecimalValue()
     {
         config.setProperty("number", "0xFF");

Modified: jakarta/commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/xdocs/changes.xml?view=diff&rev=469268&r1=469267&r2=469268
==============================================================================
--- jakarta/commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/configuration/trunk/xdocs/changes.xml Mon Oct 30 12:50:59 2006
@@ -23,6 +23,10 @@
 
   <body>
     <release version="1.4-dev" date="in SVN">
+      <action dev="oheger" type="update" issue="CONFIGURATION-235">
+        Interpolation of non string values did not work when SubsetConfiguration
+        was involved. This has now been fixed.
+      </action>
       <action dev="oheger" type="update" issue="CONFIGURATION-227">
         The compatibility of ConfigurationDynaBean with other configuration types
         than those that inherit from BaseConfiguration was improved.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message