commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1231720 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/CombinedConfiguration.java test/java/org/apache/commons/configuration/TestCombinedConfiguration.java
Date Sun, 15 Jan 2012 18:31:12 GMT
Author: oheger
Date: Sun Jan 15 18:31:12 2012
New Revision: 1231720

URL: http://svn.apache.org/viewvc?rev=1231720&view=rev
Log:
Removed unnecessary casts.
Changed return type of clone() method back to Object to restore binary compatibility.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/CombinedConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/CombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/CombinedConfiguration.java?rev=1231720&r1=1231719&r2=1231720&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/CombinedConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/CombinedConfiguration.java
Sun Jan 15 18:31:12 2012
@@ -460,7 +460,7 @@ public class CombinedConfiguration exten
      */
     public Configuration getConfiguration(int index)
     {
-        ConfigData cd = (ConfigData) configurations.get(index);
+        ConfigData cd = configurations.get(index);
         return cd.getConfiguration();
     }
 
@@ -473,7 +473,7 @@ public class CombinedConfiguration exten
      */
     public Configuration getConfiguration(String name)
     {
-        return (Configuration) namedConfigurations.get(name);
+        return namedConfigurations.get(name);
     }
 
     /**
@@ -518,7 +518,7 @@ public class CombinedConfiguration exten
     {
         for (int index = 0; index < getNumberOfConfigurations(); index++)
         {
-            if (((ConfigData) configurations.get(index)).getConfiguration() == config)
+            if (configurations.get(index).getConfiguration() == config)
             {
                 removeConfigurationAt(index);
                 return true;
@@ -536,7 +536,7 @@ public class CombinedConfiguration exten
      */
     public Configuration removeConfigurationAt(int index)
     {
-        ConfigData cd = (ConfigData) configurations.remove(index);
+        ConfigData cd = configurations.remove(index);
         if (cd.getName() != null)
         {
             namedConfigurations.remove(cd.getName());
@@ -653,7 +653,7 @@ public class CombinedConfiguration exten
      * @return the copied object
      */
     @Override
-    public CombinedConfiguration clone()
+    public Object clone()
     {
         CombinedConfiguration copy = (CombinedConfiguration) super.clone();
         copy.clear();

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java?rev=1231720&r1=1231719&r2=1231720&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java
Sun Jan 15 18:31:12 2012
@@ -392,7 +392,7 @@ public class TestCombinedConfiguration
         config.addConfiguration(setUpTestConfiguration(), TEST_NAME, "conf2");
         config.addConfiguration(new PropertiesConfiguration(), "props");
 
-        CombinedConfiguration cc2 = config.clone();
+        CombinedConfiguration cc2 = (CombinedConfiguration) config.clone();
         assertEquals("Wrong number of contained configurations", config
                 .getNumberOfConfigurations(), cc2.getNumberOfConfigurations());
         assertSame("Wrong node combiner", config.getNodeCombiner(), cc2
@@ -423,7 +423,7 @@ public class TestCombinedConfiguration
     public void testCloneModify()
     {
         config.addConfiguration(setUpTestConfiguration(), TEST_NAME);
-        CombinedConfiguration cc2 = config.clone();
+        CombinedConfiguration cc2 = (CombinedConfiguration) config.clone();
         assertTrue("Name is missing", cc2.getConfigurationNames().contains(
                 TEST_NAME));
         cc2.removeConfiguration(TEST_NAME);



Mime
View raw message