commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject commons-dbutils git commit: Convert 'for' loops to enhanced 'for' loops.
Date Sun, 06 May 2018 16:21:26 GMT
Repository: commons-dbutils
Updated Branches:
  refs/heads/master e2c137f95 -> 84869ad01


Convert 'for' loops to enhanced 'for' loops.

Project: http://git-wip-us.apache.org/repos/asf/commons-dbutils/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbutils/commit/84869ad0
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbutils/tree/84869ad0
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbutils/diff/84869ad0

Branch: refs/heads/master
Commit: 84869ad01624685179821b69a0fb158ec05c24b2
Parents: e2c137f
Author: Gary Gregory <garydgregory@gmail.com>
Authored: Sun May 6 10:21:24 2018 -0600
Committer: Gary Gregory <garydgregory@gmail.com>
Committed: Sun May 6 10:21:24 2018 -0600

----------------------------------------------------------------------
 .../java/org/apache/commons/dbutils/AbstractQueryRunner.java | 3 +--
 src/main/java/org/apache/commons/dbutils/QueryRunner.java    | 8 ++++----
 .../commons/dbutils/wrappers/SqlNullCheckedResultSet.java    | 6 +++---
 3 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/84869ad0/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java b/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
index 13bb1db..7db2cd1 100644
--- a/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
+++ b/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
@@ -410,8 +410,7 @@ public abstract class AbstractQueryRunner {
                         + i);
             }
             boolean found = false;
-            for (int j = 0; j < descriptors.length; j++) {
-                final PropertyDescriptor descriptor = descriptors[j];
+            for (final PropertyDescriptor descriptor : descriptors) {
                 if (propertyName.equals(descriptor.getName())) {
                     sorted[i] = descriptor;
                     found = true;

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/84869ad0/src/main/java/org/apache/commons/dbutils/QueryRunner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/QueryRunner.java b/src/main/java/org/apache/commons/dbutils/QueryRunner.java
index b7fb46b..85bae22 100644
--- a/src/main/java/org/apache/commons/dbutils/QueryRunner.java
+++ b/src/main/java/org/apache/commons/dbutils/QueryRunner.java
@@ -185,8 +185,8 @@ public class QueryRunner extends AbstractQueryRunner {
         try {
             stmt = this.prepareStatement(conn, sql);
 
-            for (int i = 0; i < params.length; i++) {
-                this.fillStatement(stmt, params[i]);
+            for (Object[] param : params) {
+                this.fillStatement(stmt, param);
                 stmt.addBatch();
             }
             rows = stmt.executeBatch();
@@ -726,8 +726,8 @@ public class QueryRunner extends AbstractQueryRunner {
         try {
             stmt = this.prepareStatement(conn, sql, Statement.RETURN_GENERATED_KEYS);
 
-            for (int i = 0; i < params.length; i++) {
-                this.fillStatement(stmt, params[i]);
+            for (Object[] param : params) {
+                this.fillStatement(stmt, param);
                 stmt.addBatch();
             }
             stmt.executeBatch();

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/84869ad0/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
b/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
index fa42f41..ea7617a 100644
--- a/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
+++ b/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
@@ -84,12 +84,12 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
 
     static {
         final Method[] methods = SqlNullCheckedResultSet.class.getMethods();
-        for (int i = 0; i < methods.length; i++) {
-            final String methodName = methods[i].getName();
+        for (Method method : methods) {
+            final String methodName = method.getName();
 
             if (methodName.startsWith(GET_NULL_PREFIX)) {
                 final String normalName = "get" + methodName.substring(GET_NULL_PREFIX.length());
-                nullMethods.put(normalName, methods[i]);
+                nullMethods.put(normalName, method);
             }
         }
     }


Mime
View raw message