commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1740057 - in /commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2: TesterConnection.java TesterPreparedStatement.java TesterResultSet.java TesterStatement.java
Date Wed, 20 Apr 2016 06:19:13 GMT
Author: ggregory
Date: Wed Apr 20 06:19:13 2016
New Revision: 1740057

URL: http://svn.apache.org/viewvc?rev=1740057&view=rev
Log:
Statement unnecessarily nested within else clause.

Modified:
    commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
    commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java
    commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java
    commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterStatement.java

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterConnection.java?rev=1740057&r1=1740056&r2=1740057&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
(original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterConnection.java
Wed Apr 20 06:19:13 2016
@@ -236,9 +236,8 @@ public class TesterConnection implements
         if (failure != null) {
             if(failure instanceof SQLException) {
                 throw (SQLException)failure;
-            } else {
-                throw new SQLException("TesterConnection failure", failure);
             }
+            throw new SQLException("TesterConnection failure", failure);
         }
     }
 

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java?rev=1740057&r1=1740056&r2=1740057&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java
(original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterPreparedStatement.java
Wed Apr 20 06:19:13 2016
@@ -85,9 +85,8 @@ public class TesterPreparedStatement ext
         checkOpen();
         if("null".equals(sql)) {
             return null;
-        } else {
-            return new TesterResultSet(this, _resultSetType, _resultSetConcurrency);
         }
+        return new TesterResultSet(this, _resultSetType, _resultSetConcurrency);
     }
 
     @Override

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java?rev=1740057&r1=1740056&r2=1740057&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java
(original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterResultSet.java
Wed Apr 20 06:19:13 2016
@@ -77,13 +77,10 @@ public class TesterResultSet implements
             _currentRow++;
             return _currentRow < _data.length;
         }
-        else {
-            if(--_rowsLeft > 0) {
-                return true;
-            } else {
-                return false;
-            }
+        if(--_rowsLeft > 0) {
+            return true;
         }
+        return false;
     }
 
     @Override

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterStatement.java?rev=1740057&r1=1740056&r2=1740057&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
(original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterStatement.java
Wed Apr 20 06:19:13 2016
@@ -72,13 +72,12 @@ public class TesterStatement implements
             final String username = ((TesterConnection) _connection).getUsername();
             final Object[][] data = {{username}};
             return new TesterResultSet(this, data);
-        } else {
-            // Simulate timeout if queryTimout is set to less than 5 seconds
-            if (_queryTimeout > 0 && _queryTimeout < 5) {
-                throw new SQLException("query timeout");
-            }
-            return new TesterResultSet(this);
         }
+        // Simulate timeout if queryTimout is set to less than 5 seconds
+        if (_queryTimeout > 0 && _queryTimeout < 5) {
+            throw new SQLException("query timeout");
+        }
+        return new TesterResultSet(this);
     }
 
     @Override



Mime
View raw message