commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1406259 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ConfigurationUtils.java test/java/org/apache/commons/configuration/TestConfigurationUtils.java
Date Tue, 06 Nov 2012 18:14:28 GMT
Author: oheger
Date: Tue Nov  6 18:14:28 2012
New Revision: 1406259

URL: http://svn.apache.org/viewvc?rev=1406259&view=rev
Log:
Use the interface rather than a concrete class in ConfigurationUtils.convertToHierarchical().

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java?rev=1406259&r1=1406258&r2=1406259&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
Tue Nov  6 18:14:28 2012
@@ -188,7 +188,7 @@ public final class ConfigurationUtils
      * and only if the passed in configuration is <b>null</b>)
      * @since 1.3
      */
-    public static BaseHierarchicalConfiguration convertToHierarchical(
+    public static HierarchicalConfiguration convertToHierarchical(
             Configuration conf)
     {
         return convertToHierarchical(conf, null);
@@ -217,7 +217,7 @@ public final class ConfigurationUtils
      *         and only if the passed in configuration is <b>null</b>)
      * @since 1.6
      */
-    public static BaseHierarchicalConfiguration convertToHierarchical(
+    public static HierarchicalConfiguration convertToHierarchical(
             Configuration conf, ExpressionEngine engine)
     {
         if (conf == null)
@@ -225,9 +225,9 @@ public final class ConfigurationUtils
             return null;
         }
 
-        if (conf instanceof BaseHierarchicalConfiguration)
+        if (conf instanceof HierarchicalConfiguration)
         {
-            BaseHierarchicalConfiguration hc;
+            HierarchicalConfiguration hc;
             if (conf instanceof Reloadable)
             {
                 Object lock = ((Reloadable) conf).getReloadLock();
@@ -238,7 +238,7 @@ public final class ConfigurationUtils
             }
             else
             {
-                hc = (BaseHierarchicalConfiguration) conf;
+                hc = (HierarchicalConfiguration) conf;
             }
             if (engine != null)
             {

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java?rev=1406259&r1=1406258&r2=1406259&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java
Tue Nov  6 18:14:28 2012
@@ -263,8 +263,9 @@ public class TestConfigurationUtils
             conf.addProperty("test.list", "item" + i);
         }
 
-        BaseHierarchicalConfiguration hc = ConfigurationUtils
-                .convertToHierarchical(conf);
+        BaseHierarchicalConfiguration hc =
+                (BaseHierarchicalConfiguration) ConfigurationUtils
+                        .convertToHierarchical(conf);
         for (Iterator<String> it = conf.getKeys(); it.hasNext();)
         {
             String key = it.next();
@@ -308,7 +309,7 @@ public class TestConfigurationUtils
         conf.addProperty("test.key", "1\\,2\\,3");
         assertEquals("Wrong property value", "1,2,3", conf
                 .getString("test.key"));
-        BaseHierarchicalConfiguration hc = ConfigurationUtils
+        HierarchicalConfiguration hc = ConfigurationUtils
                 .convertToHierarchical(conf);
         assertEquals("Escaped list delimiters not correctly handled", "1,2,3",
                 hc.getString("test.key"));
@@ -327,7 +328,7 @@ public class TestConfigurationUtils
         DefaultExpressionEngine engine = new DefaultExpressionEngine();
         engine.setIndexStart("[");
         engine.setIndexEnd("]");
-        BaseHierarchicalConfiguration hc = ConfigurationUtils
+        HierarchicalConfiguration hc = ConfigurationUtils
                 .convertToHierarchical(conf, engine);
         assertTrue("Wrong value for test(a)", hc.getBoolean("test(a)"));
         assertFalse("Wrong value for test(b)", hc.getBoolean("test(b)"));
@@ -373,7 +374,7 @@ public class TestConfigurationUtils
     {
         BaseConfiguration config = new BaseConfiguration();
         config.addProperty("test", "1,2,3");
-        BaseHierarchicalConfiguration hc = ConfigurationUtils
+        HierarchicalConfiguration hc = ConfigurationUtils
                 .convertToHierarchical(config);
         assertEquals("Wrong value 1", 1, hc.getInt("test(0)"));
         assertEquals("Wrong value 2", 2, hc.getInt("test(1)"));



Mime
View raw message