commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1571732 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/builder/combined/ main/java/org/apache/commons/configuration/plist/ main/java/org/apache/commons/configuration/web/ test/java/org/apache/commo...
Date Tue, 25 Feb 2014 16:35:01 GMT
Author: ggregory
Date: Tue Feb 25 16:35:00 2014
New Revision: 1571732

URL: http://svn.apache.org/r1571732
Log:
Convert 'for' loops to enhanced 'for' loops.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfigurationXMLReader.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDynamicCombinedConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestConfigurationDynaBean.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultConfigurationNode.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultExpressionEngine.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestXPathExpressionEngine.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java
Tue Feb 25 16:35:00 2014
@@ -1598,9 +1598,8 @@ public class CombinedConfigurationBuilde
                     .hasNext();)
             {
                 String nodeName = it.next().getRootElementName();
-                for (int i = 0; i < CONFIG_SECTIONS.length; i++)
-                {
-                    if (CONFIG_SECTIONS[i].equals(nodeName))
+                for (String element : CONFIG_SECTIONS) {
+                    if (element.equals(nodeName))
                     {
                         it.remove();
                         break;

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/plist/PropertyListConfiguration.java
Tue Feb 25 16:35:00 2014
@@ -421,9 +421,8 @@ public class PropertyListConfiguration e
     {
         StringBuilder buf = new StringBuilder();
 
-        for (int i = 0; i < DATE_PARSERS.length; i++)
-        {
-            DATE_PARSERS[i].formatComponent(buf, cal);
+        for (DateComponentParser element : DATE_PARSERS) {
+            element.formatComponent(buf, cal);
         }
 
         return buf.toString();

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
Tue Feb 25 16:35:00 2014
@@ -66,9 +66,8 @@ public class ServletRequestConfiguration
         {
             // ensure that escape characters in all list elements are removed
             List<Object> result = new ArrayList<Object>(values.length);
-            for (int i = 0; i < values.length; i++)
-            {
-                Object val = handleDelimiters(values[i]);
+            for (String value : values) {
+                Object val = handleDelimiters(value);
                 if (val instanceof Collection)
                 {
                     result.addAll((Collection<?>) val);

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java
Tue Feb 25 16:35:00 2014
@@ -141,9 +141,8 @@ public class MockInitialContextFactory i
                     + PROP_NAMES[i];
             bindError(mockCtx, errProp);
         }
-        for (int i = 0; i < MISSING_NAMES.length; i++)
-        {
-            bindError(mockCtx, MISSING_NAMES[i]);
+        for (String element : MISSING_NAMES) {
+            bindError(mockCtx, element);
         }
         mockCtx.matchAndReturn("hashCode", System.identityHashCode(mockCtx.proxy()));
 

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfigurationXMLReader.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfigurationXMLReader.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfigurationXMLReader.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfigurationXMLReader.java
Tue Feb 25 16:35:00 2014
@@ -134,10 +134,9 @@ public class TestBaseConfigurationXMLRea
     private void check(JXPathContext ctx, String path, String[] values)
     {
         Iterator<?> it = ctx.iterate(path);
-        for (int i = 0; i < values.length; i++)
-        {
+        for (String value : values) {
             assertTrue("Too few values", it.hasNext());
-            assertEquals("Wrong property value", values[i], it.next());
+            assertEquals("Wrong property value", value, it.next());
         }
         assertFalse("Too many values", it.hasNext());
     }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDynamicCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDynamicCombinedConfiguration.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDynamicCombinedConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDynamicCombinedConfiguration.java
Tue Feb 25 16:35:00 2014
@@ -387,14 +387,12 @@ public class TestDynamicCombinedConfigur
         String rows = config.getString("rowsPerPage");
         assertEquals("Incorrect value for rowsPerPage", "25", rows);
 
-        for (int i = 0; i < testThreads.length; ++i)
-        {
-            testThreads[i].shutdown();
-            testThreads[i].join();
+        for (ReaderThread testThread : testThreads) {
+            testThread.shutdown();
+            testThread.join();
         }
-        for (int i = 0; i < testThreads.length; ++i)
-        {
-            assertFalse(testThreads[i].failed());
+        for (ReaderThread testThread : testThreads) {
+            assertFalse(testThread.failed());
         }
         assertEquals("ID0002", config.getString("Product/FIIndex/FI[@id='123456782']"));
         output.delete();

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
Tue Feb 25 16:35:00 2014
@@ -1174,9 +1174,8 @@ public class TestHierarchicalConfigurati
     private void checkKeys(String prefix, String[] expected)
     {
         Set<String> values = new HashSet<String>();
-        for(int i = 0; i < expected.length; i++)
-        {
-            values.add((expected[i].startsWith(prefix)) ? expected[i] :  prefix + "." + expected[i]);
+        for (String element : expected) {
+            values.add((element.startsWith(prefix)) ? element :  prefix + "." + element);
         }
 
         Iterator<String> itKeys = config.getKeys(prefix);

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertiesConfiguration.java
Tue Feb 25 16:35:00 2014
@@ -923,9 +923,8 @@ public class TestPropertiesConfiguration
             String s;
             while ((s = in.readLine()) != null)
             {
-                for (int i = 0; i < separatorTests.length; i++)
-                {
-                    if (separatorTests[i].equals(s))
+                for (String separatorTest : separatorTests) {
+                    if (separatorTest.equals(s))
                     {
                         foundLines.add(s);
                     }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
Tue Feb 25 16:35:00 2014
@@ -1540,9 +1540,8 @@ public class TestXMLConfiguration
             assertTrue("Property not found", config.getProperty("test.short") != null);
         }
 
-        for (int i = 0; i < testThreads.length; ++i)
-        {
-            testThreads[i].join();
+        for (Thread testThread : testThreads) {
+            testThread.join();
         }
     }
 

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestConfigurationDynaBean.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestConfigurationDynaBean.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestConfigurationDynaBean.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestConfigurationDynaBean.java
Tue Feb 25 16:35:00 2014
@@ -115,14 +115,12 @@ public class TestConfigurationDynaBean
             configuration.setProperty(properties[i], values[i]);
         }
 
-        for (int a = 0; a < intArray.length; a++)
-        {
-            configuration.addProperty("intIndexed", new Integer(intArray[a]));
+        for (int element : intArray) {
+            configuration.addProperty("intIndexed", new Integer(element));
         }
 
-        for (int a = 0; a < stringArray.length; a++)
-        {
-            configuration.addProperty("stringIndexed", stringArray[a]);
+        for (String element : stringArray) {
+            configuration.addProperty("stringIndexed", element);
         }
 
         List<String> list = Arrays.asList(stringArray);
@@ -245,9 +243,8 @@ public class TestConfigurationDynaBean
         DynaProperty pd[] = bean.getDynaClass().getDynaProperties();
         assertNotNull("Got descriptors", pd);
         int count[] = new int[properties.length];
-        for (int i = 0; i < pd.length; i++)
-        {
-            String name = pd[i].getName();
+        for (DynaProperty element : pd) {
+            String name = element.getName();
             for (int j = 0; j < properties.length; j++)
             {
                 if (name.equals(properties[j]))

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/beanutils/TestXMLBeanDeclaration.java
Tue Feb 25 16:35:00 2014
@@ -345,9 +345,8 @@ public class TestXMLBeanDeclaration
             }
         };
         Map<String, Object> nested = decl.getNestedBeanDeclarations();
-        for (int i = 0; i < COMPLEX_PROPS.length; i++)
-        {
-            Object d = nested.get(COMPLEX_PROPS[i]);
+        for (String element : COMPLEX_PROPS) {
+            Object d = nested.get(element);
             assertTrue("Wrong class for bean declaration: " + d,
                     d instanceof XMLBeanDeclarationTestImpl);
         }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultConfigurationNode.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultConfigurationNode.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultConfigurationNode.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultConfigurationNode.java
Tue Feb 25 16:35:00 2014
@@ -452,8 +452,7 @@ public class TestDefaultConfigurationNod
      */
     private void checkFieldNodes(Iterator<ConfigurationNode> itFields)
     {
-        for (int i = 0; i < FIELD_NAMES.length; i++)
-        {
+        for (String element : FIELD_NAMES) {
             DefaultConfigurationNode child = (DefaultConfigurationNode) itFields
                     .next();
             assertEquals("Wrong node", "field", child.getName());
@@ -461,7 +460,7 @@ public class TestDefaultConfigurationNod
             assertEquals("Wrong number of name nodes", 1, nameNodes.size());
             DefaultConfigurationNode nameNode = (DefaultConfigurationNode) nameNodes
                     .get(0);
-            assertEquals("Wrong field name", FIELD_NAMES[i], nameNode
+            assertEquals("Wrong field name", element, nameNode
                     .getValue());
         }
     }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultExpressionEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultExpressionEngine.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultExpressionEngine.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/TestDefaultExpressionEngine.java
Tue Feb 25 16:35:00 2014
@@ -527,10 +527,9 @@ public class TestDefaultExpressionEngine
         List<ConfigurationNode> nodes = engine.query(root, key);
         assertEquals("Wrong number of result nodes for key " + key, count,
                 nodes.size());
-        for (Iterator<ConfigurationNode> it = nodes.iterator(); it.hasNext();)
-        {
+        for (ConfigurationNode configurationNode : nodes) {
             assertEquals("Wrong result node for key " + key, name,
-                    it.next().getName());
+                    configurationNode.getName());
         }
         return nodes;
     }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java
Tue Feb 25 16:35:00 2014
@@ -63,9 +63,8 @@ public class TestConfigurationNodePointe
     {
         List<?> nodes = context.selectNodes(CHILD_NAME1);
         assertEquals("Incorrect number of results", 2, nodes.size());
-        for (Iterator<?> it = nodes.iterator(); it.hasNext();)
-        {
-            ConfigurationNode node = (ConfigurationNode) it.next();
+        for (Object name : nodes) {
+            ConfigurationNode node = (ConfigurationNode) name;
             assertEquals("Incorrect node name", CHILD_NAME1, node.getName());
             assertEquals("Incorrect parent node", root, node.getParentNode());
         }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestXPathExpressionEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestXPathExpressionEngine.java?rev=1571732&r1=1571731&r2=1571732&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestXPathExpressionEngine.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestXPathExpressionEngine.java
Tue Feb 25 16:35:00 2014
@@ -130,9 +130,8 @@ public class TestXPathExpressionEngine
         NodePointerFactory[] factories = JXPathContextReferenceImpl
                 .getNodePointerFactories();
         boolean found = false;
-        for (int i = 0; i < factories.length; i++)
-        {
-            if (factories[i] instanceof ConfigurationNodePointerFactory)
+        for (NodePointerFactory factorie : factories) {
+            if (factorie instanceof ConfigurationNodePointerFactory)
             {
                 found = true;
             }



Mime
View raw message