commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1729274 [6/7] - in /commons/proper/dbcp/trunk/src: main/java/org/apache/commons/dbcp2/ main/java/org/apache/commons/dbcp2/cpdsadapter/ main/java/org/apache/commons/dbcp2/datasources/ main/java/org/apache/commons/dbcp2/managed/ test/java/or...
Date Mon, 08 Feb 2016 21:56:49 GMT
Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java Mon Feb  8 21:56:48 2016
@@ -62,7 +62,7 @@ public abstract class TestConnectionPool
             Connection conn = connections.pop();
             try {
                 conn.close();
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 // ignore
             } finally {
                 conn = null;
@@ -85,7 +85,7 @@ public abstract class TestConnectionPool
 
     /** Acquire a connection and push it onto the connections stack */
     protected Connection newConnection() throws Exception {
-        Connection connection = getConnection();
+        final Connection connection = getConnection();
         connections.push(connection);
         return connection;
     }
@@ -93,8 +93,8 @@ public abstract class TestConnectionPool
     // ----------- Utility Methods ---------------------------------
 
     protected String getUsername(Connection conn) throws SQLException {
-        Statement stmt = conn.createStatement();
-        ResultSet rs = stmt.executeQuery("select username");
+        final Statement stmt = conn.createStatement();
+        final ResultSet rs = stmt.executeQuery("select username");
         if (rs.next()) {
             return rs.getString(1);
         }
@@ -105,7 +105,7 @@ public abstract class TestConnectionPool
 
     @Test
     public void testClearWarnings() throws Exception {
-        Connection[] c = new Connection[getMaxTotal()];
+        final Connection[] c = new Connection[getMaxTotal()];
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
             assertTrue(c[i] != null);
@@ -115,11 +115,11 @@ public abstract class TestConnectionPool
             }
         }
 
-        for (Connection element : c) {
+        for (final Connection element : c) {
             assertNotNull(element.getWarnings());
         }
 
-        for (Connection element : c) {
+        for (final Connection element : c) {
             element.close();
         }
 
@@ -127,12 +127,12 @@ public abstract class TestConnectionPool
             c[i] = newConnection();
         }
 
-        for (Connection element : c) {
+        for (final Connection element : c) {
             // warnings should have been cleared by putting the connection back in the pool
             assertNull(element.getWarnings());
         }
 
-        for (Connection element : c) {
+        for (final Connection element : c) {
             element.close();
         }
     }
@@ -140,12 +140,12 @@ public abstract class TestConnectionPool
     @Test
     public void testIsClosed() throws Exception {
         for(int i=0;i<getMaxTotal();i++) {
-            Connection conn = newConnection();
+            final Connection conn = newConnection();
             assertNotNull(conn);
             assertTrue(!conn.isClosed());
-            PreparedStatement stmt = conn.prepareStatement("select * from dual");
+            final PreparedStatement stmt = conn.prepareStatement("select * from dual");
             assertNotNull(stmt);
-            ResultSet rset = stmt.executeQuery();
+            final ResultSet rset = stmt.executeQuery();
             assertNotNull(rset);
             assertTrue(rset.next());
             rset.close();
@@ -162,7 +162,7 @@ public abstract class TestConnectionPool
     @Test
     public void testCanCloseConnectionTwice() throws Exception {
         for (int i = 0; i < getMaxTotal(); i++) { // loop to show we *can* close again once we've borrowed it from the pool again
-            Connection conn = newConnection();
+            final Connection conn = newConnection();
             assertNotNull(conn);
             assertTrue(!conn.isClosed());
             conn.close();
@@ -174,11 +174,11 @@ public abstract class TestConnectionPool
 
     @Test
     public void testCanCloseStatementTwice() throws Exception {
-        Connection conn = newConnection();
+        final Connection conn = newConnection();
         assertNotNull(conn);
         assertTrue(!conn.isClosed());
         for(int i=0;i<2;i++) { // loop to show we *can* close again once we've borrowed it from the pool again
-            Statement stmt = conn.createStatement();
+            final Statement stmt = conn.createStatement();
             assertNotNull(stmt);
             assertFalse(isClosed(stmt));
             stmt.close();
@@ -193,11 +193,11 @@ public abstract class TestConnectionPool
 
     @Test
     public void testCanClosePreparedStatementTwice() throws Exception {
-        Connection conn = newConnection();
+        final Connection conn = newConnection();
         assertNotNull(conn);
         assertTrue(!conn.isClosed());
         for(int i=0;i<2;i++) { // loop to show we *can* close again once we've borrowed it from the pool again
-            PreparedStatement stmt = conn.prepareStatement("select * from dual");
+            final PreparedStatement stmt = conn.prepareStatement("select * from dual");
             assertNotNull(stmt);
             assertFalse(isClosed(stmt));
             stmt.close();
@@ -212,11 +212,11 @@ public abstract class TestConnectionPool
 
     @Test
     public void testCanCloseCallableStatementTwice() throws Exception {
-        Connection conn = newConnection();
+        final Connection conn = newConnection();
         assertNotNull(conn);
         assertTrue(!conn.isClosed());
         for(int i=0;i<2;i++) { // loop to show we *can* close again once we've borrowed it from the pool again
-            PreparedStatement stmt = conn.prepareCall("select * from dual");
+            final PreparedStatement stmt = conn.prepareCall("select * from dual");
             assertNotNull(stmt);
             assertFalse(isClosed(stmt));
             stmt.close();
@@ -231,13 +231,13 @@ public abstract class TestConnectionPool
 
     @Test
     public void testCanCloseResultSetTwice() throws Exception {
-        Connection conn = newConnection();
+        final Connection conn = newConnection();
         assertNotNull(conn);
         assertTrue(!conn.isClosed());
         for(int i=0;i<2;i++) { // loop to show we *can* close again once we've borrowed it from the pool again
-            PreparedStatement stmt = conn.prepareStatement("select * from dual");
+            final PreparedStatement stmt = conn.prepareStatement("select * from dual");
             assertNotNull(stmt);
-            ResultSet rset = stmt.executeQuery();
+            final ResultSet rset = stmt.executeQuery();
             assertNotNull(rset);
             assertFalse(isClosed(rset));
             rset.close();
@@ -290,24 +290,24 @@ public abstract class TestConnectionPool
         assertSame("statement.getConnection() should return the exact same connection instance that was used to create the statement",
                 conn, statement.getConnection());
 
-        ResultSet resultSet = statement.getResultSet();
+        final ResultSet resultSet = statement.getResultSet();
         assertFalse(isClosed(resultSet));
         assertSame("resultSet.getStatement() should return the exact same statement instance that was used to create the result set",
                 statement, resultSet.getStatement());
 
-        ResultSet executeResultSet = statement.executeQuery("select * from dual");
+        final ResultSet executeResultSet = statement.executeQuery("select * from dual");
         assertFalse(isClosed(executeResultSet));
         assertSame("resultSet.getStatement() should return the exact same statement instance that was used to create the result set",
                 statement, executeResultSet.getStatement());
 
-        ResultSet keysResultSet = statement.getGeneratedKeys();
+        final ResultSet keysResultSet = statement.getGeneratedKeys();
         assertFalse(isClosed(keysResultSet));
         assertSame("resultSet.getStatement() should return the exact same statement instance that was used to create the result set",
                 statement, keysResultSet.getStatement());
 
         ResultSet preparedResultSet = null;
         if (statement instanceof PreparedStatement) {
-            PreparedStatement preparedStatement = (PreparedStatement) statement;
+            final PreparedStatement preparedStatement = (PreparedStatement) statement;
             preparedResultSet = preparedStatement.executeQuery();
             assertFalse(isClosed(preparedResultSet));
             assertSame("resultSet.getStatement() should return the exact same statement instance that was used to create the result set",
@@ -328,11 +328,11 @@ public abstract class TestConnectionPool
 
     @Test
     public void testSimple() throws Exception {
-        Connection conn = newConnection();
+        final Connection conn = newConnection();
         assertNotNull(conn);
-        PreparedStatement stmt = conn.prepareStatement("select * from dual");
+        final PreparedStatement stmt = conn.prepareStatement("select * from dual");
         assertNotNull(stmt);
-        ResultSet rset = stmt.executeQuery();
+        final ResultSet rset = stmt.executeQuery();
         assertNotNull(rset);
         assertTrue(rset.next());
         rset.close();
@@ -343,11 +343,11 @@ public abstract class TestConnectionPool
     @Test
     public void testRepeatedBorrowAndReturn() throws Exception {
         for(int i=0;i<100;i++) {
-            Connection conn = newConnection();
+            final Connection conn = newConnection();
             assertNotNull(conn);
-            PreparedStatement stmt = conn.prepareStatement("select * from dual");
+            final PreparedStatement stmt = conn.prepareStatement("select * from dual");
             assertNotNull(stmt);
-            ResultSet rset = stmt.executeQuery();
+            final ResultSet rset = stmt.executeQuery();
             assertNotNull(rset);
             assertTrue(rset.next());
             rset.close();
@@ -361,18 +361,18 @@ public abstract class TestConnectionPool
         Connection conn = newConnection();
         assertNotNull(conn);
         {
-            PreparedStatement stmt = conn.prepareStatement("select * from dual");
+            final PreparedStatement stmt = conn.prepareStatement("select * from dual");
             assertNotNull(stmt);
-            ResultSet rset = stmt.executeQuery();
+            final ResultSet rset = stmt.executeQuery();
             assertNotNull(rset);
             assertTrue(rset.next());
             rset.close();
             stmt.close();
         }
         {
-            PreparedStatement stmt = conn.prepareStatement("select * from dual");
+            final PreparedStatement stmt = conn.prepareStatement("select * from dual");
             assertNotNull(stmt);
-            ResultSet rset = stmt.executeQuery();
+            final ResultSet rset = stmt.executeQuery();
             assertNotNull(rset);
             assertTrue(rset.next());
             rset.close();
@@ -381,25 +381,25 @@ public abstract class TestConnectionPool
         conn.close();
         try (Statement s = conn.createStatement()){
             fail("Can't use closed connections");
-        } catch(SQLException e) {
+        } catch(final SQLException e) {
             // expected
         }
 
         conn = newConnection();
         assertNotNull(conn);
         {
-            PreparedStatement stmt = conn.prepareStatement("select * from dual");
+            final PreparedStatement stmt = conn.prepareStatement("select * from dual");
             assertNotNull(stmt);
-            ResultSet rset = stmt.executeQuery();
+            final ResultSet rset = stmt.executeQuery();
             assertNotNull(rset);
             assertTrue(rset.next());
             rset.close();
             stmt.close();
         }
         {
-            PreparedStatement stmt = conn.prepareStatement("select * from dual");
+            final PreparedStatement stmt = conn.prepareStatement("select * from dual");
             assertNotNull(stmt);
-            ResultSet rset = stmt.executeQuery();
+            final ResultSet rset = stmt.executeQuery();
             assertNotNull(rset);
             assertTrue(rset.next());
             rset.close();
@@ -412,8 +412,8 @@ public abstract class TestConnectionPool
     @Test
     public void testPooling() throws Exception {
         // Grab a maximal set of open connections from the pool
-        Connection[] c = new Connection[getMaxTotal()];
-        Connection[] u = new Connection[getMaxTotal()];
+        final Connection[] c = new Connection[getMaxTotal()];
+        final Connection[] u = new Connection[getMaxTotal()];
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
             if (c[i] instanceof DelegatingConnection) {
@@ -427,10 +427,10 @@ public abstract class TestConnectionPool
         }
         // Close connections one at a time and get new ones, making sure
         // the new ones come from the pool
-        for (Connection element : c) {
+        for (final Connection element : c) {
             element.close();
-            Connection con = newConnection();
-            Connection underCon =
+            final Connection con = newConnection();
+            final Connection underCon =
                 ((DelegatingConnection<?>) con).getInnermostDelegate();
             assertTrue("Failed to get connection", underCon != null);
             boolean found = false;
@@ -447,11 +447,11 @@ public abstract class TestConnectionPool
 
     @Test
     public void testAutoCommitBehavior() throws Exception {
-        Connection conn0 = newConnection();
+        final Connection conn0 = newConnection();
         assertNotNull("connection should not be null", conn0);
         assertTrue("autocommit should be true for conn0", conn0.getAutoCommit());
 
-        Connection conn1 = newConnection();
+        final Connection conn1 = newConnection();
         assertTrue("autocommit should be true for conn1", conn1.getAutoCommit() );
         conn1.close();
 
@@ -460,10 +460,10 @@ public abstract class TestConnectionPool
         assertFalse("autocommit should be false for conn0", conn0.getAutoCommit());
         conn0.close();
 
-        Connection conn2 = newConnection();
+        final Connection conn2 = newConnection();
         assertTrue("autocommit should be true for conn2", conn2.getAutoCommit() );
 
-        Connection conn3 = newConnection();
+        final Connection conn3 = newConnection();
         assertTrue("autocommit should be true for conn3", conn3.getAutoCommit() );
 
         conn2.close();
@@ -474,7 +474,7 @@ public abstract class TestConnectionPool
     /** "http://issues.apache.org/bugzilla/show_bug.cgi?id=12400" */
     @Test
     public void testConnectionsAreDistinct() throws Exception {
-        Connection[] conn = new Connection[getMaxTotal()];
+        final Connection[] conn = new Connection[getMaxTotal()];
         for(int i=0;i<conn.length;i++) {
             conn[i] = newConnection();
             for(int j=0;j<i;j++) {
@@ -482,14 +482,14 @@ public abstract class TestConnectionPool
                 assertTrue(!conn[j].equals(conn[i]));
             }
         }
-        for (Connection element : conn) {
+        for (final Connection element : conn) {
             element.close();
         }
     }
 
     @Test
     public void testOpening() throws Exception {
-        Connection[] c = new Connection[getMaxTotal()];
+        final Connection[] c = new Connection[getMaxTotal()];
         // test that opening new connections is not closing previous
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
@@ -499,14 +499,14 @@ public abstract class TestConnectionPool
             }
         }
 
-        for (Connection element : c) {
+        for (final Connection element : c) {
             element.close();
         }
     }
 
     @Test
     public void testClosing() throws Exception {
-        Connection[] c = new Connection[getMaxTotal()];
+        final Connection[] c = new Connection[getMaxTotal()];
         // open the maximum connections
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
@@ -519,14 +519,14 @@ public abstract class TestConnectionPool
         // get a new connection
         c[0] = newConnection();
 
-        for (Connection element : c) {
+        for (final Connection element : c) {
             element.close();
         }
     }
 
     @Test
     public void testMaxTotal() throws Exception {
-        Connection[] c = new Connection[getMaxTotal()];
+        final Connection[] c = new Connection[getMaxTotal()];
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
             assertTrue(c[i] != null);
@@ -535,12 +535,12 @@ public abstract class TestConnectionPool
         try {
             newConnection();
             fail("Allowed to open more than DefaultMaxTotal connections.");
-        } catch (java.sql.SQLException e) {
+        } catch (final java.sql.SQLException e) {
             // should only be able to open 10 connections, so this test should
             // throw an exception
         }
 
-        for (Connection element : c) {
+        for (final Connection element : c) {
             element.close();
         }
     }
@@ -551,8 +551,8 @@ public abstract class TestConnectionPool
      */
     @Test
     public void testHashing() throws Exception {
-        Connection con = getConnection();
-        Hashtable<Connection, String> hash = new Hashtable<>();
+        final Connection con = getConnection();
+        final Hashtable<Connection, String> hash = new Hashtable<>();
         hash.put(con, "test");
         assertEquals("test", hash.get(con));
         assertTrue(hash.containsKey(con));
@@ -563,17 +563,17 @@ public abstract class TestConnectionPool
 
     @Test
     public void testThreaded() {
-        TestThread[] threads = new TestThread[getMaxTotal()];
+        final TestThread[] threads = new TestThread[getMaxTotal()];
         for(int i=0;i<threads.length;i++) {
             threads[i] = new TestThread(50,50);
-            Thread t = new Thread(threads[i]);
+            final Thread t = new Thread(threads[i]);
             t.start();
         }
         for(int i=0;i<threads.length;i++) {
             while(!(threads[i]).complete()) {
                 try {
                     Thread.sleep(100L);
-                } catch(Exception e) {
+                } catch(final Exception e) {
                     // ignored
                 }
             }
@@ -615,7 +615,7 @@ public abstract class TestConnectionPool
             for(int i=0;i<_iter;i++) {
                 try {
                     Thread.sleep(_random.nextInt(_delay));
-                } catch(Exception e) {
+                } catch(final Exception e) {
                     // ignored
                 }
                 try (Connection conn = newConnection();
@@ -624,10 +624,10 @@ public abstract class TestConnectionPool
                         ResultSet rset = stmt.executeQuery();) {
                     try {
                         Thread.sleep(_random.nextInt(_delay));
-                    } catch(Exception e) {
+                    } catch(final Exception e) {
                         // ignored
                     }
-                } catch(Exception e) {
+                } catch(final Exception e) {
                     e.printStackTrace();
                     _failed = true;
                     _complete = true;
@@ -644,12 +644,12 @@ public abstract class TestConnectionPool
     @Test
     public void testPrepareStatementOptions() throws Exception
     {
-        Connection conn = newConnection();
+        final Connection conn = newConnection();
         assertNotNull(conn);
-        PreparedStatement stmt = conn.prepareStatement("select * from dual",
+        final PreparedStatement stmt = conn.prepareStatement("select * from dual",
             ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
         assertNotNull(stmt);
-        ResultSet rset = stmt.executeQuery();
+        final ResultSet rset = stmt.executeQuery();
         assertNotNull(rset);
         assertTrue(rset.next());
 
@@ -665,11 +665,11 @@ public abstract class TestConnectionPool
     // wrong order of passivate/close when a rset isn't closed
     @Test
     public void testNoRsetClose() throws Exception {
-        Connection conn = newConnection();
+        final Connection conn = newConnection();
         assertNotNull(conn);
-        PreparedStatement stmt = conn.prepareStatement("test");
+        final PreparedStatement stmt = conn.prepareStatement("test");
         assertNotNull(stmt);
-        ResultSet rset = stmt.getResultSet();
+        final ResultSet rset = stmt.getResultSet();
         assertNotNull(rset);
         // forget to close the resultset: rset.close();
         stmt.close();
@@ -679,9 +679,9 @@ public abstract class TestConnectionPool
     // Bugzilla Bug 26966: Connectionpool's connections always returns same
     @Test
     public void testHashCode() throws Exception {
-        Connection conn1 = newConnection();
+        final Connection conn1 = newConnection();
         assertNotNull(conn1);
-        Connection conn2 = newConnection();
+        final Connection conn2 = newConnection();
         assertNotNull(conn2);
 
         assertTrue(conn1.hashCode() != conn2.hashCode());
@@ -691,7 +691,7 @@ public abstract class TestConnectionPool
         try {
             statement.getWarnings();
             return false;
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             // getWarnings throws an exception if the statement is
             // closed, but could throw an exception for other reasons
             // in this case it is good enought to assume the statement
@@ -704,7 +704,7 @@ public abstract class TestConnectionPool
         try {
             resultSet.getWarnings();
             return false;
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             // getWarnings throws an exception if the statement is
             // closed, but could throw an exception for other reasons
             // in this case it is good enought to assume the result set
@@ -758,13 +758,13 @@ public abstract class TestConnectionPool
     protected void multipleThreads(final int holdTime,
             final boolean expectError, final boolean loopOnce,
             final long maxWaitMillis, int numStatements, int numThreads, long duration) throws Exception {
-                long startTime = timeStamp();
+                final long startTime = timeStamp();
                 final PoolTest[] pts = new PoolTest[numThreads];
                 // Catch Exception so we can stop all threads if one fails
-                ThreadGroup threadGroup = new ThreadGroup("foo") {
+                final ThreadGroup threadGroup = new ThreadGroup("foo") {
                     @Override
                     public void uncaughtException(Thread t, Throwable e) {
-                        for (PoolTest pt : pts) {
+                        for (final PoolTest pt : pts) {
                             pt.stop();
                         }
                     }
@@ -774,7 +774,7 @@ public abstract class TestConnectionPool
                     pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce, numStatements);
                 }
                 // Start all the threads
-                for (PoolTest pt : pts) {
+                for (final PoolTest pt : pts) {
                     pt.start();
                 }
 
@@ -782,7 +782,7 @@ public abstract class TestConnectionPool
                 Thread.sleep(duration);
 
                 // Stop threads
-                for (PoolTest pt : pts) {
+                for (final PoolTest pt : pts) {
                     pt.stop();
                 }
 
@@ -814,7 +814,7 @@ public abstract class TestConnectionPool
                     }
                 }
 
-                long time = timeStamp() - startTime;
+                final long time = timeStamp() - startTime;
                 System.out.println("Multithread test time = " + time
                         + " ms. Threads: " + pts.length
                         + ". Loops: " + loops
@@ -827,10 +827,10 @@ public abstract class TestConnectionPool
                         );
                 if (expectError) {
                     if (DISPLAY_THREAD_DETAILS || (pts.length/2 != failed)){
-                        long offset = pts[0].created - 1000; // To reduce size of output numbers, but ensure they have 4 digits
+                        final long offset = pts[0].created - 1000; // To reduce size of output numbers, but ensure they have 4 digits
                         System.out.println("Offset: "+offset);
                         for (int i = 0; i < pts.length; i++) {
-                            PoolTest pt = pts[i];
+                            final PoolTest pt = pts[i];
                             System.out.println(
                                     "Pre: " + (pt.preconnected-offset) // First, so can sort on this easily
                                     + ". Post: " + (pt.postconnected != 0 ? Long.toString(pt.postconnected-offset): "-")
@@ -926,16 +926,16 @@ public abstract class TestConnectionPool
                     loops++;
                     state = "Getting Connection";
                     preconnected = timeStamp();
-                    Connection conn = getConnection();
+                    final Connection conn = getConnection();
                     connHash = System.identityHashCode(((DelegatingConnection<?>)conn).getInnermostDelegate());
                     connected = timeStamp();
                     state = "Using Connection";
                     assertNotNull(conn);
                     final String sql = numStatements == 1 ? "select * from dual" : "select count " + random.nextInt(numStatements - 1);
-                    PreparedStatement stmt =
+                    final PreparedStatement stmt =
                         conn.prepareStatement(sql);
                     assertNotNull(stmt);
-                    ResultSet rset = stmt.executeQuery();
+                    final ResultSet rset = stmt.executeQuery();
                     assertNotNull(rset);
                     assertTrue(rset.next());
                     state = "Holding Connection";
@@ -953,7 +953,7 @@ public abstract class TestConnectionPool
                     }
                 }
                 state = DONE;
-            } catch (Throwable t) {
+            } catch (final Throwable t) {
                 thrown = t;
                 if (!stopOnException) {
                     throw new RuntimeException();

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java Mon Feb  8 21:56:48 2016
@@ -54,7 +54,7 @@ public class TestDelegatingConnection {
 
     @Test
     public void testConnectionToString() throws Exception {
-        String s = conn.toString();
+        final String s = conn.toString();
         assertNotNull(s);
         assertTrue(s.length() > 0);
     }
@@ -66,7 +66,7 @@ public class TestDelegatingConnection {
         try {
             conn.checkOpen();
             fail("Expecting SQLException");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             // expected
         }
     }
@@ -80,7 +80,7 @@ public class TestDelegatingConnection {
             conn.close();
             conn.checkOpen();
             fail("Expecting SQLException");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             assertTrue(ex.getMessage().endsWith("is closed."));
         }
 
@@ -89,19 +89,19 @@ public class TestDelegatingConnection {
             conn.setClosedInternal(true);
             conn.checkOpen();
             fail("Expecting SQLException");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             assertTrue(ex.getMessage().endsWith("is null."));
         }
 
         try {
-            PoolingConnection pc = new PoolingConnection(delegateConn2);
+            final PoolingConnection pc = new PoolingConnection(delegateConn2);
             pc.setStatementPool(new GenericKeyedObjectPool<>(pc));
             conn = new DelegatingConnection<>(pc);
             pc.close();
             conn.close();
             try (PreparedStatement ps = conn.prepareStatement("")){}
             fail("Expecting SQLException");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             assertTrue(ex.getMessage().endsWith("is closed."));
         }
 
@@ -110,7 +110,7 @@ public class TestDelegatingConnection {
             conn.close();
             conn.checkOpen();
             fail("Expecting SQLException");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             assertTrue(ex.getMessage().endsWith("is closed."));
         }
     }

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java Mon Feb  8 21:56:48 2016
@@ -53,7 +53,7 @@ public class TestDelegatingDatabaseMetaD
     @Test
     /* JDBC_4_ANT_KEY_BEGIN */
     public void testCheckOpen() throws Exception {
-        ResultSet rst = meta.getSchemas();
+        final ResultSet rst = meta.getSchemas();
         assertTrue(!rst.isClosed());
         conn.close();
         assertTrue(rst.isClosed());

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java Mon Feb  8 21:56:48 2016
@@ -68,19 +68,19 @@ public class TestDelegatingStatement {
         try {
             stmt.checkOpen();
             fail("Expecting SQLException");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             // expected
         }
     }
 
     @Test
     public void testIsWrapperFor() throws Exception {
-        TesterConnection tstConn = new TesterConnection("test", "test");
-        TesterStatement tstStmt = new TesterStatementNonWrapping(tstConn);
-        DelegatingConnection<TesterConnection> dconn = new DelegatingConnection<>(tstConn);
-        DelegatingStatement stamt = new DelegatingStatement(dconn, tstStmt);
+        final TesterConnection tstConn = new TesterConnection("test", "test");
+        final TesterStatement tstStmt = new TesterStatementNonWrapping(tstConn);
+        final DelegatingConnection<TesterConnection> dconn = new DelegatingConnection<>(tstConn);
+        final DelegatingStatement stamt = new DelegatingStatement(dconn, tstStmt);
 
-        Class<?> stmtProxyClass = Proxy.getProxyClass(
+        final Class<?> stmtProxyClass = Proxy.getProxyClass(
                 this.getClass().getClassLoader(),
                 Statement.class);
 

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java Mon Feb  8 21:56:48 2016
@@ -69,10 +69,10 @@ public class TestDriverManagerConnection
     }
 
     public void testDriverManagerInit(final boolean withProperties) throws Exception {
-        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
+        final GenericObjectPoolConfig config = new GenericObjectPoolConfig();
         config.setMaxTotal(10);
         config.setMaxIdle(0);
-        Properties properties = new Properties();
+        final Properties properties = new Properties();
         // The names "user" and "password" are specified in java.sql.DriverManager.getConnection(String, String, String)
         properties.put("user", "foo");
         properties.put("password", "bar");
@@ -84,14 +84,14 @@ public class TestDriverManagerConnection
         poolableConnectionFactory.setDefaultReadOnly(Boolean.FALSE);
         poolableConnectionFactory.setDefaultAutoCommit(Boolean.TRUE);
 
-        GenericObjectPool<PoolableConnection> connectionPool =
+        final GenericObjectPool<PoolableConnection> connectionPool =
                 new GenericObjectPool<>(poolableConnectionFactory, config);
         poolableConnectionFactory.setPool(connectionPool);
-        PoolingDataSource<PoolableConnection> dataSource =
+        final PoolingDataSource<PoolableConnection> dataSource =
                 new PoolingDataSource<>(connectionPool);
 
-        ConnectionThread[] connectionThreads = new ConnectionThread[10];
-        Thread[] threads = new Thread[10];
+        final ConnectionThread[] connectionThreads = new ConnectionThread[10];
+        final Thread[] threads = new Thread[10];
 
         for (int i = 0; i < 10; i++) {
             connectionThreads[i] = new ConnectionThread(dataSource);
@@ -123,14 +123,14 @@ public class TestDriverManagerConnection
             Connection conn = null;
             try {
                 conn = ds.getConnection();
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 e.printStackTrace();
                 result = false;
             } finally {
                 if (conn != null) {
                     try {
                         conn.close();
-                    } catch (Exception e) {
+                    } catch (final Exception e) {
                         e.printStackTrace();
                         result = false;
                     }

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestJndi.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestJndi.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestJndi.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestJndi.java Mon Feb  8 21:56:48 2016
@@ -58,7 +58,7 @@ public class TestJndi {
      */
     @Test
     public void testBasicDataSourceBind() throws Exception {
-        BasicDataSource dataSource = new BasicDataSource();
+        final BasicDataSource dataSource = new BasicDataSource();
         checkBind(dataSource);      
     }
     
@@ -69,7 +69,7 @@ public class TestJndi {
      */
     @Test
     public void testSharedPoolDataSourceBind() throws Exception {
-        SharedPoolDataSource dataSource = new SharedPoolDataSource();
+        final SharedPoolDataSource dataSource = new SharedPoolDataSource();
         checkBind(dataSource);      
     }
     
@@ -80,7 +80,7 @@ public class TestJndi {
      */
     @Test
     public void testPerUserPoolDataSourceBind() throws Exception {
-        PerUserPoolDataSource dataSource = new PerUserPoolDataSource();
+        final PerUserPoolDataSource dataSource = new PerUserPoolDataSource();
         checkBind(dataSource);      
     }
     
@@ -122,8 +122,8 @@ public class TestJndi {
      * @throws Exception if the jndi lookup fails or no DataSource is bound.
      */
     protected DataSource retrieveDataSource() throws Exception {
-        Context ctx = getInitialContext();
-        DataSource dataSource = (DataSource) ctx.lookup(JNDI_PATH);
+        final Context ctx = getInitialContext();
+        final DataSource dataSource = (DataSource) ctx.lookup(JNDI_PATH);
 
         if (dataSource == null) {
             fail("DataSource should not be null");
@@ -139,10 +139,10 @@ public class TestJndi {
      *         or created.
      */
     protected InitialContext getInitialContext() throws NamingException {
-        Hashtable<String, String> environment = new Hashtable<>();
+        final Hashtable<String, String> environment = new Hashtable<>();
         environment.put(Context.INITIAL_CONTEXT_FACTORY,
                 org.apache.naming.java.javaURLContextFactory.class.getName());
-        InitialContext ctx = new InitialContext(environment);
+        final InitialContext ctx = new InitialContext(environment);
         return ctx;
     }
 }

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java Mon Feb  8 21:56:48 2016
@@ -47,13 +47,13 @@ public class TestPStmtPooling {
 
     @Test
     public void testStmtPool() throws Exception {
-        DataSource ds = createPDS();
+        final DataSource ds = createPDS();
         try (Connection conn = ds.getConnection()) {
-            Statement stmt1 = conn.prepareStatement("select 1 from dual");
-            Statement ustmt1 = ((DelegatingStatement) stmt1).getInnermostDelegate();
+            final Statement stmt1 = conn.prepareStatement("select 1 from dual");
+            final Statement ustmt1 = ((DelegatingStatement) stmt1).getInnermostDelegate();
             stmt1.close();
-            Statement stmt2 = conn.prepareStatement("select 1 from dual");
-            Statement ustmt2 = ((DelegatingStatement) stmt2).getInnermostDelegate();
+            final Statement stmt2 = conn.prepareStatement("select 1 from dual");
+            final Statement ustmt2 = ((DelegatingStatement) stmt2).getInnermostDelegate();
             stmt2.close();
             assertSame(ustmt1, ustmt2);
         }
@@ -66,17 +66,17 @@ public class TestPStmtPooling {
      */
     @Test
     public void testMultipleClose() throws Exception {
-       DataSource ds = createPDS();
+       final DataSource ds = createPDS();
        PreparedStatement stmt1 = null;
-       Connection conn = ds.getConnection();
+       final Connection conn = ds.getConnection();
        stmt1 = conn.prepareStatement("select 1 from dual");
-       PoolablePreparedStatement<?> pps1 = getPoolablePreparedStatement(stmt1);
+       final PoolablePreparedStatement<?> pps1 = getPoolablePreparedStatement(stmt1);
        conn.close();
        assertTrue(stmt1.isClosed());  // Closing conn should close stmt
        stmt1.close(); // Should already be closed - no-op
        assertTrue(stmt1.isClosed());
-       Connection conn2 = ds.getConnection();
-       PreparedStatement stmt2 = conn2.prepareStatement("select 1 from dual");
+       final Connection conn2 = ds.getConnection();
+       final PreparedStatement stmt2 = conn2.prepareStatement("select 1 from dual");
        // Confirm stmt2 now wraps the same PPS wrapped by stmt1
        Assert.assertSame(pps1, getPoolablePreparedStatement(stmt2));
        stmt1.close(); // close should not cascade to PPS that stmt1 used to wrap
@@ -106,15 +106,15 @@ public class TestPStmtPooling {
 
     private DataSource createPDS() throws Exception {
         DriverManager.registerDriver(new TesterDriver());
-        ConnectionFactory connFactory = new DriverManagerConnectionFactory(
+        final ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                 "jdbc:apache:commons:testdriver","u1","p1");
 
-        PoolableConnectionFactory pcf =
+        final PoolableConnectionFactory pcf =
             new PoolableConnectionFactory(connFactory, null);
         pcf.setPoolStatements(true);
         pcf.setDefaultReadOnly(Boolean.FALSE);
         pcf.setDefaultAutoCommit(Boolean.TRUE);
-        ObjectPool<PoolableConnection> connPool = new GenericObjectPool<>(pcf);
+        final ObjectPool<PoolableConnection> connPool = new GenericObjectPool<>(pcf);
         pcf.setPool(connPool);
 
         return new PoolingDataSource<>(connPool);
@@ -124,43 +124,43 @@ public class TestPStmtPooling {
     @Test
     public void testCallableStatementPooling() throws Exception {
         DriverManager.registerDriver(new TesterDriver());
-        ConnectionFactory connFactory = new DriverManagerConnectionFactory(
+        final ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                 "jdbc:apache:commons:testdriver","u1","p1");
 
-        ObjectName oName = new ObjectName("UnitTests:DataSource=test");
-        PoolableConnectionFactory pcf =
+        final ObjectName oName = new ObjectName("UnitTests:DataSource=test");
+        final PoolableConnectionFactory pcf =
             new PoolableConnectionFactory(connFactory, oName);
         pcf.setPoolStatements(true);
         pcf.setDefaultReadOnly(Boolean.FALSE);
         pcf.setDefaultAutoCommit(Boolean.TRUE);
 
-        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
+        final GenericObjectPoolConfig config = new GenericObjectPoolConfig();
         config.setJmxNameBase("UnitTests:DataSource=test,connectionpool=connections");
         config.setJmxNamePrefix("");
-        ObjectPool<PoolableConnection> connPool =
+        final ObjectPool<PoolableConnection> connPool =
                 new GenericObjectPool<>(pcf, config);
         pcf.setPool(connPool);
 
-        PoolingDataSource<?> ds = new PoolingDataSource<>(connPool);
+        final PoolingDataSource<?> ds = new PoolingDataSource<>(connPool);
 
         try (Connection conn = ds.getConnection()) {
-            Statement stmt1 = conn.prepareStatement("select 1 from dual");
-            Statement ustmt1 = ((DelegatingStatement) stmt1).getInnermostDelegate();
-            Statement cstmt1 = conn.prepareCall("{call home}");
-            Statement ucstmt1 = ((DelegatingStatement) cstmt1).getInnermostDelegate();
+            final Statement stmt1 = conn.prepareStatement("select 1 from dual");
+            final Statement ustmt1 = ((DelegatingStatement) stmt1).getInnermostDelegate();
+            final Statement cstmt1 = conn.prepareCall("{call home}");
+            final Statement ucstmt1 = ((DelegatingStatement) cstmt1).getInnermostDelegate();
             stmt1.close();  // Return to pool
             cstmt1.close(); // ""
-            Statement stmt2 = conn.prepareStatement("select 1 from dual"); // Check out from pool
-            Statement ustmt2 = ((DelegatingStatement) stmt2).getInnermostDelegate();
-            Statement cstmt2 = conn.prepareCall("{call home}");
-            Statement ucstmt2 = ((DelegatingStatement) cstmt2).getInnermostDelegate();
+            final Statement stmt2 = conn.prepareStatement("select 1 from dual"); // Check out from pool
+            final Statement ustmt2 = ((DelegatingStatement) stmt2).getInnermostDelegate();
+            final Statement cstmt2 = conn.prepareCall("{call home}");
+            final Statement ucstmt2 = ((DelegatingStatement) cstmt2).getInnermostDelegate();
             stmt2.close();  // Return to pool
             cstmt2.close(); // ""
             assertSame(ustmt1, ustmt2);
             assertSame(ucstmt1, ucstmt2);
             // Verify key distinguishes Callable from Prepared Statements in the pool
-            Statement stmt3 = conn.prepareCall("select 1 from dual");
-            Statement ustmt3 = ((DelegatingStatement) stmt3).getInnermostDelegate();
+            final Statement stmt3 = conn.prepareCall("select 1 from dual");
+            final Statement ustmt3 = ((DelegatingStatement) stmt3).getInnermostDelegate();
             stmt3.close();
             assertNotSame(ustmt1, ustmt3);
             assertNotSame(ustmt3, ucstmt1);
@@ -171,31 +171,31 @@ public class TestPStmtPooling {
     @Test
     public void testClosePool() throws Exception {
         DriverManager.registerDriver(new TesterDriver());
-        ConnectionFactory connFactory = new DriverManagerConnectionFactory(
+        final ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                 "jdbc:apache:commons:testdriver","u1","p1");
 
-        PoolableConnectionFactory pcf =
+        final PoolableConnectionFactory pcf =
             new PoolableConnectionFactory(connFactory, null);
         pcf.setPoolStatements(true);
         pcf.setDefaultReadOnly(Boolean.FALSE);
         pcf.setDefaultAutoCommit(Boolean.TRUE);
 
-        ObjectPool<PoolableConnection> connPool = new GenericObjectPool<>(pcf);
+        final ObjectPool<PoolableConnection> connPool = new GenericObjectPool<>(pcf);
         pcf.setPool(connPool);
 
-        PoolingDataSource<?> ds = new PoolingDataSource<>(connPool);
+        final PoolingDataSource<?> ds = new PoolingDataSource<>(connPool);
         ((PoolingDataSource<?>) ds).setAccessToUnderlyingConnectionAllowed(true);
 
-        Connection conn = ds.getConnection();
+        final Connection conn = ds.getConnection();
         try (Statement s = conn.prepareStatement("select 1 from dual")) {}
 
-        Connection poolableConnection = ((DelegatingConnection<?>) conn).getDelegate();
-        Connection poolingConnection =
+        final Connection poolableConnection = ((DelegatingConnection<?>) conn).getDelegate();
+        final Connection poolingConnection =
             ((DelegatingConnection<?>) poolableConnection).getDelegate();
         poolingConnection.close();
         try (PreparedStatement ps = conn.prepareStatement("select 1 from dual")) {
             fail("Expecting SQLException");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             assertTrue(ex.getMessage().endsWith("invalid PoolingConnection."));
         }
         ds.close();
@@ -204,22 +204,22 @@ public class TestPStmtPooling {
     @Test
     public void testBatchUpdate() throws Exception {
         DriverManager.registerDriver(new TesterDriver());
-        ConnectionFactory connFactory = new DriverManagerConnectionFactory(
+        final ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                 "jdbc:apache:commons:testdriver","u1","p1");
 
-        PoolableConnectionFactory pcf =
+        final PoolableConnectionFactory pcf =
             new PoolableConnectionFactory(connFactory, null);
         pcf.setPoolStatements(true);
         pcf.setDefaultReadOnly(Boolean.FALSE);
         pcf.setDefaultAutoCommit(Boolean.TRUE);
-        ObjectPool<PoolableConnection> connPool = new GenericObjectPool<>(pcf);
+        final ObjectPool<PoolableConnection> connPool = new GenericObjectPool<>(pcf);
         pcf.setPool(connPool);
 
-        PoolingDataSource<?> ds = new PoolingDataSource<>(connPool);
+        final PoolingDataSource<?> ds = new PoolingDataSource<>(connPool);
 
-        Connection conn = ds.getConnection();
-        PreparedStatement ps = conn.prepareStatement("select 1 from dual");
-        Statement inner = ((DelegatingPreparedStatement) ps).getInnermostDelegate();
+        final Connection conn = ds.getConnection();
+        final PreparedStatement ps = conn.prepareStatement("select 1 from dual");
+        final Statement inner = ((DelegatingPreparedStatement) ps).getInnermostDelegate();
         // Check DBCP-372
         ps.addBatch();
         ps.close();

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPoolingBasicDataSource.java Mon Feb  8 21:56:48 2016
@@ -51,13 +51,13 @@ public class TestPStmtPoolingBasicDataSo
 
     @Test
     public void testPreparedStatementPooling() throws Exception {
-        Connection conn = getConnection();
+        final Connection conn = getConnection();
         assertNotNull(conn);
 
-        PreparedStatement stmt1 = conn.prepareStatement("select 'a' from dual");
+        final PreparedStatement stmt1 = conn.prepareStatement("select 'a' from dual");
         assertNotNull(stmt1);
 
-        PreparedStatement stmt2 = conn.prepareStatement("select 'b' from dual");
+        final PreparedStatement stmt2 = conn.prepareStatement("select 'b' from dual");
         assertNotNull(stmt2);
 
         assertTrue(stmt1 != stmt2);
@@ -67,7 +67,7 @@ public class TestPStmtPoolingBasicDataSo
         try (PreparedStatement ps = conn.prepareStatement("select 'c' from dual")) {
             fail("expected SQLException");
         }
-        catch (SQLException e) {}
+        catch (final SQLException e) {}
 
         // make idle
         stmt2.close();
@@ -80,7 +80,7 @@ public class TestPStmtPoolingBasicDataSo
 
         // normal reuse of statement
         stmt1.close();
-        PreparedStatement stmt4 = conn.prepareStatement("select 'a' from dual");
+        final PreparedStatement stmt4 = conn.prepareStatement("select 'a' from dual");
         assertNotNull(stmt4);
     }
 
@@ -93,16 +93,16 @@ public class TestPStmtPoolingBasicDataSo
     public void testLRUBehavior() throws Exception {
         ds.setMaxOpenPreparedStatements(3);
 
-        Connection conn = getConnection();
+        final Connection conn = getConnection();
         assertNotNull(conn);
 
         // Open 3 statements and then close them into the pool
-        PreparedStatement stmt1 = conn.prepareStatement("select 'a' from dual");
-        PreparedStatement inner1 = (PreparedStatement) ((DelegatingPreparedStatement) stmt1).getInnermostDelegate();
-        PreparedStatement stmt2 = conn.prepareStatement("select 'b' from dual");
-        PreparedStatement inner2 = (PreparedStatement) ((DelegatingPreparedStatement) stmt2).getInnermostDelegate();
-        PreparedStatement stmt3 = conn.prepareStatement("select 'c' from dual");
-        PreparedStatement inner3 = (PreparedStatement) ((DelegatingPreparedStatement) stmt3).getInnermostDelegate();
+        final PreparedStatement stmt1 = conn.prepareStatement("select 'a' from dual");
+        final PreparedStatement inner1 = (PreparedStatement) ((DelegatingPreparedStatement) stmt1).getInnermostDelegate();
+        final PreparedStatement stmt2 = conn.prepareStatement("select 'b' from dual");
+        final PreparedStatement inner2 = (PreparedStatement) ((DelegatingPreparedStatement) stmt2).getInnermostDelegate();
+        final PreparedStatement stmt3 = conn.prepareStatement("select 'c' from dual");
+        final PreparedStatement inner3 = (PreparedStatement) ((DelegatingPreparedStatement) stmt3).getInnermostDelegate();
         stmt1.close();
         Thread.sleep(100); // Make sure return timestamps are different
         stmt2.close();
@@ -110,14 +110,14 @@ public class TestPStmtPoolingBasicDataSo
         stmt3.close();
 
         // Pool now has three idle statements, getting another one will force oldest (stmt1) out
-        PreparedStatement stmt4 = conn.prepareStatement("select 'd' from dual");
+        final PreparedStatement stmt4 = conn.prepareStatement("select 'd' from dual");
         assertNotNull(stmt4);
 
         // Verify that inner1 has been closed
         try {
             inner1.clearParameters();
             fail("expecting SQLExcption - statement should be closed");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             //Expected
         }
         // But others are still open
@@ -125,15 +125,15 @@ public class TestPStmtPoolingBasicDataSo
         inner3.clearParameters();
 
         // Now make sure stmt1 does not come back from the dead
-        PreparedStatement stmt5 = conn.prepareStatement("select 'a' from dual");
-        PreparedStatement inner5 = (PreparedStatement) ((DelegatingPreparedStatement) stmt5).getInnermostDelegate();
+        final PreparedStatement stmt5 = conn.prepareStatement("select 'a' from dual");
+        final PreparedStatement inner5 = (PreparedStatement) ((DelegatingPreparedStatement) stmt5).getInnermostDelegate();
         assertNotSame(inner5, inner1);
 
         // inner2 should be closed now
         try {
             inner2.clearParameters();
             fail("expecting SQLExcption - statement should be closed");
-        } catch (SQLException ex) {
+        } catch (final SQLException ex) {
             //Expected
         }
         // But inner3 should still be open
@@ -144,22 +144,22 @@ public class TestPStmtPoolingBasicDataSo
     // PreparedStatement cache should be different depending on the Catalog
     @Test
     public void testPStmtCatalog() throws Exception {
-        Connection conn = getConnection();
+        final Connection conn = getConnection();
         conn.setCatalog("catalog1");
-        DelegatingPreparedStatement stmt1 = (DelegatingPreparedStatement) conn.prepareStatement("select 'a' from dual");
-        TesterPreparedStatement inner1 = (TesterPreparedStatement) stmt1.getInnermostDelegate();
+        final DelegatingPreparedStatement stmt1 = (DelegatingPreparedStatement) conn.prepareStatement("select 'a' from dual");
+        final TesterPreparedStatement inner1 = (TesterPreparedStatement) stmt1.getInnermostDelegate();
         assertEquals("catalog1", inner1.getCatalog());
         stmt1.close();
 
         conn.setCatalog("catalog2");
-        DelegatingPreparedStatement stmt2 = (DelegatingPreparedStatement) conn.prepareStatement("select 'a' from dual");
-        TesterPreparedStatement inner2 = (TesterPreparedStatement) stmt2.getInnermostDelegate();
+        final DelegatingPreparedStatement stmt2 = (DelegatingPreparedStatement) conn.prepareStatement("select 'a' from dual");
+        final TesterPreparedStatement inner2 = (TesterPreparedStatement) stmt2.getInnermostDelegate();
         assertEquals("catalog2", inner2.getCatalog());
         stmt2.close();
 
         conn.setCatalog("catalog1");
-        DelegatingPreparedStatement stmt3 = (DelegatingPreparedStatement) conn.prepareStatement("select 'a' from dual");
-        TesterPreparedStatement inner3 = (TesterPreparedStatement) stmt3.getInnermostDelegate();
+        final DelegatingPreparedStatement stmt3 = (DelegatingPreparedStatement) conn.prepareStatement("select 'a' from dual");
+        final TesterPreparedStatement inner3 = (TesterPreparedStatement) stmt3.getInnermostDelegate();
         assertEquals("catalog1", inner3.getCatalog());
         stmt3.close();
 
@@ -172,28 +172,28 @@ public class TestPStmtPoolingBasicDataSo
         ds.setMaxTotal(1); // only one connection in pool needed
         ds.setMaxIdle(1);
         ds.setAccessToUnderlyingConnectionAllowed(true);
-        Connection conn1 = getConnection();
+        final Connection conn1 = getConnection();
         assertNotNull(conn1);
         assertEquals(1, ds.getNumActive());
         assertEquals(0, ds.getNumIdle());
 
-        PreparedStatement stmt1 = conn1.prepareStatement("select 'a' from dual");
+        final PreparedStatement stmt1 = conn1.prepareStatement("select 'a' from dual");
         assertNotNull(stmt1);
 
-        Statement inner1 = ((DelegatingPreparedStatement) stmt1).getInnermostDelegate();
+        final Statement inner1 = ((DelegatingPreparedStatement) stmt1).getInnermostDelegate();
         assertNotNull(inner1);
 
         stmt1.close();
 
-        Connection conn2 = conn1;
+        final Connection conn2 = conn1;
         assertNotNull(conn2);
         assertEquals(1, ds.getNumActive());
         assertEquals(0, ds.getNumIdle());
 
-        PreparedStatement stmt2 = conn2.prepareStatement("select 'a' from dual");
+        final PreparedStatement stmt2 = conn2.prepareStatement("select 'a' from dual");
         assertNotNull(stmt2);
 
-        Statement inner2 = ((DelegatingPreparedStatement) stmt2).getInnermostDelegate();
+        final Statement inner2 = ((DelegatingPreparedStatement) stmt2).getInnermostDelegate();
         assertNotNull(inner2);
 
         assertSame(inner1, inner2);
@@ -204,15 +204,15 @@ public class TestPStmtPoolingBasicDataSo
         ds.setMaxTotal(1); // only one connection in pool needed
         ds.setMaxIdle(1);
         ds.setAccessToUnderlyingConnectionAllowed(true);
-        Connection conn1 = getConnection();
+        final Connection conn1 = getConnection();
         assertNotNull(conn1);
         assertEquals(1, ds.getNumActive());
         assertEquals(0, ds.getNumIdle());
 
-        PreparedStatement stmt1 = conn1.prepareStatement("select 'a' from dual");
+        final PreparedStatement stmt1 = conn1.prepareStatement("select 'a' from dual");
         assertNotNull(stmt1);
 
-        Statement inner1 = ((DelegatingPreparedStatement) stmt1).getInnermostDelegate();
+        final Statement inner1 = ((DelegatingPreparedStatement) stmt1).getInnermostDelegate();
         assertNotNull(inner1);
 
         stmt1.close();
@@ -221,15 +221,15 @@ public class TestPStmtPoolingBasicDataSo
         assertEquals(0, ds.getNumActive());
         assertEquals(1, ds.getNumIdle());
 
-        Connection conn2 = getConnection();
+        final Connection conn2 = getConnection();
         assertNotNull(conn2);
         assertEquals(1, ds.getNumActive());
         assertEquals(0, ds.getNumIdle());
 
-        PreparedStatement stmt2 = conn2.prepareStatement("select 'a' from dual");
+        final PreparedStatement stmt2 = conn2.prepareStatement("select 'a' from dual");
         assertNotNull(stmt2);
 
-        Statement inner2 = ((DelegatingPreparedStatement) stmt2).getInnermostDelegate();
+        final Statement inner2 = ((DelegatingPreparedStatement) stmt2).getInnermostDelegate();
         assertNotNull(inner2);
 
         assertSame(inner1, inner2);

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolableConnection.java Mon Feb  8 21:56:48 2016
@@ -40,7 +40,7 @@ public class TestPoolableConnection {
 
     @Before
     public void setUp() throws Exception {
-        PoolableConnectionFactory factory = new PoolableConnectionFactory(
+        final PoolableConnectionFactory factory = new PoolableConnectionFactory(
                 new DriverConnectionFactory(
                         new TesterDriver(),"jdbc:apache:commons:testdriver", null),
                 null);
@@ -60,7 +60,7 @@ public class TestPoolableConnection {
     @Test
     public void testConnectionPool() throws Exception {
         // Grab a new connection from the pool
-        Connection c = pool.borrowObject();
+        final Connection c = pool.borrowObject();
 
         assertNotNull("Connection should be created and should not be null", c);
         assertEquals("There should be exactly one active object in the pool", 1, pool.getNumActive());
@@ -76,7 +76,7 @@ public class TestPoolableConnection {
     @Test
     public void testPoolableConnectionLeak() throws Exception {
         // 'Borrow' a connection from the pool
-        Connection conn = pool.borrowObject();
+        final Connection conn = pool.borrowObject();
 
         // Now close our innermost delegate, simulating the case where the
         // underlying connection closes itself
@@ -89,7 +89,7 @@ public class TestPoolableConnection {
 
         try {
             conn.close();
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             // Here we expect 'connection already closed', but the connection
             // should *NOT* be returned to the pool
         }
@@ -102,8 +102,8 @@ public class TestPoolableConnection {
     public void testClosingWrappedInDelegate() throws Exception {
         Assert.assertEquals(0, pool.getNumActive());
 
-        Connection conn = pool.borrowObject();
-        DelegatingConnection<Connection> outer = new DelegatingConnection<>(conn);
+        final Connection conn = pool.borrowObject();
+        final DelegatingConnection<Connection> outer = new DelegatingConnection<>(conn);
 
         Assert.assertFalse(outer.isClosed());
         Assert.assertFalse(conn.isClosed());
@@ -120,17 +120,17 @@ public class TestPoolableConnection {
     @Test
     public void testFastFailValidation() throws Exception {
         pool.setTestOnReturn(true);
-        PoolableConnectionFactory factory = (PoolableConnectionFactory) pool.getFactory();
+        final PoolableConnectionFactory factory = (PoolableConnectionFactory) pool.getFactory();
         factory.setFastFailValidation(true);
-        PoolableConnection conn = pool.borrowObject();
-        TesterConnection nativeConnection = (TesterConnection) conn.getInnermostDelegate();
+        final PoolableConnection conn = pool.borrowObject();
+        final TesterConnection nativeConnection = (TesterConnection) conn.getInnermostDelegate();
 
         // Set up non-fatal exception
         nativeConnection.setFailure(new SQLException("Not fatal error.", "Invalid syntax."));
         try {
             conn.createStatement();
             fail("Should throw SQL exception.");
-        } catch (SQLException ignored) {
+        } catch (final SQLException ignored) {
             // cleanup failure
             nativeConnection.setFailure(null);
         }
@@ -144,7 +144,7 @@ public class TestPoolableConnection {
         try {
             conn.createStatement();
             fail("Should throw SQL exception.");
-        } catch (SQLException ignored) {
+        } catch (final SQLException ignored) {
             // cleanup failure
             nativeConnection.setFailure(null);
         }
@@ -153,7 +153,7 @@ public class TestPoolableConnection {
         try {
             conn.validate("SELECT 1", 1000);
             fail("Should throw SQL exception on validation.");
-        } catch (SQLException notValid){
+        } catch (final SQLException notValid){
             // expected - fatal error && fastFailValidation
         }
 
@@ -168,13 +168,13 @@ public class TestPoolableConnection {
     @Test
     public void testFastFailValidationCustomCodes() throws Exception {
         pool.setTestOnReturn(true);
-        PoolableConnectionFactory factory = (PoolableConnectionFactory) pool.getFactory();
+        final PoolableConnectionFactory factory = (PoolableConnectionFactory) pool.getFactory();
         factory.setFastFailValidation(true);
-        ArrayList<String> disconnectionSqlCodes = new ArrayList<>();
+        final ArrayList<String> disconnectionSqlCodes = new ArrayList<>();
         disconnectionSqlCodes.add("XXX");
         factory.setDisconnectionSqlCodes(disconnectionSqlCodes);
-        PoolableConnection conn = pool.borrowObject();
-        TesterConnection nativeConnection = (TesterConnection) conn.getInnermostDelegate();
+        final PoolableConnection conn = pool.borrowObject();
+        final TesterConnection nativeConnection = (TesterConnection) conn.getInnermostDelegate();
 
         // Set up fatal exception
         nativeConnection.setFailure(new SQLException("Fatal connection error.", "XXX"));
@@ -182,7 +182,7 @@ public class TestPoolableConnection {
         try {
             conn.createStatement();
             fail("Should throw SQL exception.");
-        } catch (SQLException ignored) {
+        } catch (final SQLException ignored) {
             // cleanup failure
             nativeConnection.setFailure(null);
         }

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolingDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolingDataSource.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolingDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolingDataSource.java Mon Feb  8 21:56:48 2016
@@ -48,10 +48,10 @@ public class TestPoolingDataSource exten
 
     @Before
     public void setUp() throws Exception {
-        Properties props = new Properties();
+        final Properties props = new Properties();
         props.setProperty("user", "username");
         props.setProperty("password", "password");
-        PoolableConnectionFactory factory =
+        final PoolableConnectionFactory factory =
             new PoolableConnectionFactory(
                     new DriverConnectionFactory(new TesterDriver(),
                             "jdbc:apache:commons:testdriver", props),
@@ -77,7 +77,7 @@ public class TestPoolingDataSource exten
     @Test
     public void testPoolGuardConnectionWrapperEqualsSameDelegate() throws Exception {
         // Get a maximal set of connections from the pool
-        Connection[] c = new Connection[getMaxTotal()];
+        final Connection[] c = new Connection[getMaxTotal()];
         for (int i = 0; i < c.length; i++) {
             c[i] = newConnection();
         }
@@ -86,12 +86,12 @@ public class TestPoolingDataSource exten
 
         // Grab a new connection - should get c[0]'s closed connection
         // so should be delegate-equivalent
-        Connection con = newConnection();
+        final Connection con = newConnection();
         Assert.assertNotEquals(c[0], con);
         Assert.assertEquals(
                 ((DelegatingConnection<?>) c[0]).getInnermostDelegateInternal(),
                 ((DelegatingConnection<?>) con).getInnermostDelegateInternal());
-        for (Connection element : c) {
+        for (final Connection element : c) {
             element.close();
         }
     }
@@ -102,8 +102,8 @@ public class TestPoolingDataSource exten
     @Test
     public void testPoolGuardConnectionWrapperEqualsReflexive()
         throws Exception {
-        Connection con = ds.getConnection();
-        Connection con2 = con;
+        final Connection con = ds.getConnection();
+        final Connection con2 = con;
         assertTrue(con2.equals(con));
         assertTrue(con.equals(con2));
         con.close();
@@ -111,8 +111,8 @@ public class TestPoolingDataSource exten
 
     @Test
     public void testPoolGuardConnectionWrapperEqualsFail() throws Exception {
-        Connection con1 = ds.getConnection();
-        Connection con2 = ds.getConnection();
+        final Connection con1 = ds.getConnection();
+        final Connection con2 = ds.getConnection();
         assertFalse(con1.equals(con2));
         con1.close();
         con2.close();
@@ -120,16 +120,16 @@ public class TestPoolingDataSource exten
 
     @Test
     public void testPoolGuardConnectionWrapperEqualsNull() throws Exception {
-        Connection con1 = ds.getConnection();
-        Connection con2 = null;
+        final Connection con1 = ds.getConnection();
+        final Connection con2 = null;
         assertFalse(con1.equals(con2));
         con1.close();
     }
 
     @Test
     public void testPoolGuardConnectionWrapperEqualsType() throws Exception {
-        Connection con1 = ds.getConnection();
-        Integer con2 = Integer.valueOf(0);
+        final Connection con1 = ds.getConnection();
+        final Integer con2 = Integer.valueOf(0);
         assertFalse(con1.equals(con2));
         con1.close();
     }
@@ -137,10 +137,10 @@ public class TestPoolingDataSource exten
     @Test
     public void testPoolGuardConnectionWrapperEqualInnermost() throws Exception {
         ds.setAccessToUnderlyingConnectionAllowed(true);
-        DelegatingConnection<?> con = (DelegatingConnection<?>) ds.getConnection();
-        Connection inner = con.getInnermostDelegate();
+        final DelegatingConnection<?> con = (DelegatingConnection<?>) ds.getConnection();
+        final Connection inner = con.getInnermostDelegate();
         ds.setAccessToUnderlyingConnectionAllowed(false);
-        DelegatingConnection<Connection> con2 = new DelegatingConnection<>(inner);
+        final DelegatingConnection<Connection> con2 = new DelegatingConnection<>(inner);
         assertFalse(con2.equals(con));
         assertTrue(con.innermostDelegateEquals(con2.getInnermostDelegate()));
         assertTrue(con2.innermostDelegateEquals(inner));
@@ -154,10 +154,10 @@ public class TestPoolingDataSource exten
      */
     @Test
     public void testFixFactoryConfig() throws Exception {
-        Properties props = new Properties();
+        final Properties props = new Properties();
         props.setProperty("user", "username");
         props.setProperty("password", "password");
-        PoolableConnectionFactory f =
+        final PoolableConnectionFactory f =
             new PoolableConnectionFactory(
                     new DriverConnectionFactory(new TesterDriver(),
                             "jdbc:apache:commons:testdriver", props),
@@ -165,7 +165,7 @@ public class TestPoolingDataSource exten
         f.setValidationQuery("SELECT DUMMY FROM DUAL");
         f.setDefaultReadOnly(Boolean.TRUE);
         f.setDefaultAutoCommit(Boolean.TRUE);
-        GenericObjectPool<PoolableConnection> p = new GenericObjectPool<>(f);
+        final GenericObjectPool<PoolableConnection> p = new GenericObjectPool<>(f);
         p.setMaxTotal(getMaxTotal());
         p.setMaxWaitMillis(getMaxWaitMillis());
         ds = new PoolingDataSource<>(p);
@@ -176,10 +176,10 @@ public class TestPoolingDataSource exten
     @Test
     public void testClose() throws Exception {
 
-        Properties props = new Properties();
+        final Properties props = new Properties();
         props.setProperty("user", "username");
         props.setProperty("password", "password");
-        PoolableConnectionFactory f =
+        final PoolableConnectionFactory f =
             new PoolableConnectionFactory(
                     new DriverConnectionFactory(new TesterDriver(),
                             "jdbc:apache:commons:testdriver", props),
@@ -187,12 +187,12 @@ public class TestPoolingDataSource exten
         f.setValidationQuery("SELECT DUMMY FROM DUAL");
         f.setDefaultReadOnly(Boolean.TRUE);
         f.setDefaultAutoCommit(Boolean.TRUE);
-        GenericObjectPool<PoolableConnection> p = new GenericObjectPool<>(f);
+        final GenericObjectPool<PoolableConnection> p = new GenericObjectPool<>(f);
         p.setMaxTotal(getMaxTotal());
         p.setMaxWaitMillis(getMaxWaitMillis());
 
         try ( PoolingDataSource<PoolableConnection> dataSource = new PoolingDataSource<>(p) ) {
-            Connection connection = dataSource.getConnection();
+            final Connection connection = dataSource.getConnection();
             assertNotNull(connection);
             connection.close();
         }

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolingDriver.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolingDriver.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolingDriver.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPoolingDriver.java Mon Feb  8 21:56:48 2016
@@ -58,16 +58,16 @@ public class TestPoolingDriver extends T
 
     @Before
     public void setUp() throws Exception {
-        DriverConnectionFactory cf = new DriverConnectionFactory(new TesterDriver(),"jdbc:apache:commons:testdriver",null);
+        final DriverConnectionFactory cf = new DriverConnectionFactory(new TesterDriver(),"jdbc:apache:commons:testdriver",null);
 
-        PoolableConnectionFactory pcf = new PoolableConnectionFactory(cf, null);
+        final PoolableConnectionFactory pcf = new PoolableConnectionFactory(cf, null);
         pcf.setPoolStatements(true);
         pcf.setMaxOpenPrepatedStatements(10);
         pcf.setValidationQuery("SELECT COUNT(*) FROM DUAL");
         pcf.setDefaultReadOnly(Boolean.FALSE);
         pcf.setDefaultAutoCommit(Boolean.TRUE);
 
-        GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
+        final GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
         poolConfig.setMaxTotal(getMaxTotal());
         poolConfig.setMaxWaitMillis(getMaxWaitMillis());
         poolConfig.setMinIdle(10);
@@ -78,7 +78,7 @@ public class TestPoolingDriver extends T
         poolConfig.setNumTestsPerEvictionRun(5);
         poolConfig.setMinEvictableIdleTimeMillis(5000L);
 
-        GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<>(pcf, poolConfig);
+        final GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<>(pcf, poolConfig);
         pcf.setPool(pool);
 
         assertNotNull(pcf);
@@ -95,39 +95,39 @@ public class TestPoolingDriver extends T
 
     @Test
     public void test1() {
-        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string","username","password");
-        PoolableConnectionFactory pcf =
+        final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string","username","password");
+        final PoolableConnectionFactory pcf =
             new PoolableConnectionFactory(connectionFactory, null);
         pcf.setDefaultReadOnly(Boolean.FALSE);
         pcf.setDefaultAutoCommit(Boolean.TRUE);
-        GenericObjectPool<PoolableConnection> connectionPool =
+        final GenericObjectPool<PoolableConnection> connectionPool =
                 new GenericObjectPool<>(pcf);
         pcf.setPool(connectionPool);
-        DataSource ds = new PoolingDataSource<>(connectionPool);
+        final DataSource ds = new PoolingDataSource<>(connectionPool);
         Assert.assertNotNull(ds);
     }
 
     @Test
     public void test2() {
-        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string","username","password");
-        PoolableConnectionFactory pcf =
+        final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string","username","password");
+        final PoolableConnectionFactory pcf =
             new PoolableConnectionFactory(connectionFactory, null);
         pcf.setDefaultReadOnly(Boolean.FALSE);
         pcf.setDefaultAutoCommit(Boolean.TRUE);
-        GenericObjectPool<PoolableConnection> connectionPool = new GenericObjectPool<>(pcf);
-        PoolingDriver driver2 = new PoolingDriver();
+        final GenericObjectPool<PoolableConnection> connectionPool = new GenericObjectPool<>(pcf);
+        final PoolingDriver driver2 = new PoolingDriver();
         driver2.registerPool("example",connectionPool);
     }
 
     /** "http://issues.apache.org/bugzilla/show_bug.cgi?id=28912" */
     @Test
     public void testReportedBug28912() throws Exception {
-        Connection conn1 = getConnection();
+        final Connection conn1 = getConnection();
         assertNotNull(conn1);
         assertFalse(conn1.isClosed());
         conn1.close();
 
-        Connection conn2 = getConnection();
+        final Connection conn2 = getConnection();
         assertNotNull(conn2);
 
         assertTrue(conn1.isClosed());
@@ -143,25 +143,25 @@ public class TestPoolingDriver extends T
     /** "http://issues.apache.org/bugzilla/show_bug.cgi?id=12400" */
     @Test
     public void testReportedBug12400() throws Exception {
-        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
+        final GenericObjectPoolConfig config = new GenericObjectPoolConfig();
         config.setMaxTotal(70);
         config.setMaxWaitMillis(60000);
         config.setMaxIdle(10);
-        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
+        final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
             "jdbc:apache:commons:testdriver",
             "username",
             "password");
-        PoolableConnectionFactory poolableConnectionFactory =
+        final PoolableConnectionFactory poolableConnectionFactory =
             new PoolableConnectionFactory(connectionFactory, null);
         poolableConnectionFactory.setDefaultReadOnly(Boolean.FALSE);
         poolableConnectionFactory.setDefaultAutoCommit(Boolean.TRUE);
-        ObjectPool<PoolableConnection> connectionPool =
+        final ObjectPool<PoolableConnection> connectionPool =
                 new GenericObjectPool<>(poolableConnectionFactory,config);
         poolableConnectionFactory.setPool(connectionPool);
         assertNotNull(poolableConnectionFactory);
-        PoolingDriver driver2 = new PoolingDriver();
+        final PoolingDriver driver2 = new PoolingDriver();
         driver2.registerPool("neusoftim",connectionPool);
-        Connection[] conn = new Connection[25];
+        final Connection[] conn = new Connection[25];
         for(int i=0;i<25;i++) {
             conn[i] = DriverManager.getConnection("jdbc:apache:commons:dbcp:neusoftim");
             for(int j=0;j<i;j++) {
@@ -176,31 +176,31 @@ public class TestPoolingDriver extends T
 
     @Test
     public void testClosePool() throws Exception {
-        Connection conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:test");
+        final Connection conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:test");
         assertNotNull(conn);
         conn.close();
 
-        PoolingDriver driver2 = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");
+        final PoolingDriver driver2 = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");
         driver2.closePool("test");
 
         try (Connection c = DriverManager.getConnection("jdbc:apache:commons:dbcp:test")) {
             fail("expected SQLException");
         }
-        catch (SQLException e) {
+        catch (final SQLException e) {
             // OK
         }
     }
 
     @Test
     public void testInvalidateConnection() throws Exception {
-        Connection conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:test");
+        final Connection conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:test");
         assertNotNull(conn);
 
-        ObjectPool<?> pool = driver.getConnectionPool("test");
+        final ObjectPool<?> pool = driver.getConnectionPool("test");
         assertEquals(1, pool.getNumActive());
         assertEquals(0, pool.getNumIdle());
 
-        PoolingDriver driver2 = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");
+        final PoolingDriver driver2 = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");
         driver2.invalidateConnection(conn);
 
         assertEquals(0, pool.getNumActive());
@@ -210,8 +210,8 @@ public class TestPoolingDriver extends T
 
     @Test
     public void testLogWriter() throws Exception {
-        PrintStream ps = new PrintStream(new ByteArrayOutputStream(), false, "UTF-8");
-        PrintWriter pw = new PrintWriter(new OutputStreamWriter(new ByteArrayOutputStream(), "UTF-8"));
+        final PrintStream ps = new PrintStream(new ByteArrayOutputStream(), false, "UTF-8");
+        final PrintWriter pw = new PrintWriter(new OutputStreamWriter(new ByteArrayOutputStream(), "UTF-8"));
         System.setErr(new PrintStream(new ByteArrayOutputStream(), false, "UTF-8"));
         SQLException ex;
 

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterClassLoader.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterClassLoader.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterClassLoader.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterClassLoader.java Mon Feb  8 21:56:48 2016
@@ -29,7 +29,7 @@ public class TesterClassLoader extends C
     @Override
     protected synchronized Class<?> loadClass(String name, boolean resolve)
             throws ClassNotFoundException {
-        Class<?> clazz =  super.loadClass(name, resolve);
+        final Class<?> clazz =  super.loadClass(name, resolve);
         loadedClasses.add(name);
         return clazz;
     }

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterDriver.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterDriver.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterDriver.java Mon Feb  8 21:56:48 2016
@@ -48,7 +48,7 @@ public class TesterDriver implements Dri
     static {
         try {
             DriverManager.registerDriver(new TesterDriver());
-        } catch(Exception e) {
+        } catch(final Exception e) {
         }
         validUserPasswords.put("foo", "bar");
         validUserPasswords.put("u1", "p1");
@@ -76,7 +76,7 @@ public class TesterDriver implements Dri
             throw new SQLException("username cannot be null.");            
         }
         synchronized (validUserPasswords) {
-            String realPassword = validUserPasswords.getProperty(user);
+            final String realPassword = validUserPasswords.getProperty(user);
             if (realPassword == null) {
                 throw new SQLException(user + " is not a valid username.");
             }
@@ -100,7 +100,7 @@ public class TesterDriver implements Dri
                 username = info.getProperty("user");
                 password = info.getProperty("password");
                 if (username == null) {
-                    String[] parts = url.split(";");
+                    final String[] parts = url.split(";");
                     username = parts[1];
                     username = username.split("=")[1];
                     password = parts[2];

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=1729274&r1=1729273&r2=1729274&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 Mon Feb  8 21:56:48 2016
@@ -50,7 +50,7 @@ public class TesterPreparedStatement ext
         super(conn);
         try {
             _catalog = conn.getCatalog();
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             // Ignored
         }
     }
@@ -60,7 +60,7 @@ public class TesterPreparedStatement ext
         _sql = sql;
         try {
             _catalog = conn.getCatalog();
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             // Ignored
         }
     }
@@ -70,7 +70,7 @@ public class TesterPreparedStatement ext
         _sql = sql;
         try {
             _catalog = conn.getCatalog();
-        } catch (SQLException e) {
+        } catch (final SQLException e) {
             // Ignored
         }
     }

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=1729274&r1=1729273&r2=1729274&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 Mon Feb  8 21:56:48 2016
@@ -273,7 +273,7 @@ public class TesterResultSet implements
         checkOpen();
         try {
             return columnName.getBytes("UTF-8");
-        } catch (UnsupportedEncodingException e) {
+        } catch (final UnsupportedEncodingException e) {
             // Impossible. JVMs are required to support UTF-8
             return null;
         }

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=1729274&r1=1729273&r2=1729274&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 Mon Feb  8 21:56:48 2016
@@ -69,8 +69,8 @@ public class TesterStatement implements
             throw new SQLException("broken connection");
         }
         if("select username".equals(sql)) {
-            String username = ((TesterConnection) _connection).getUsername();
-            Object[][] data = {{username}};
+            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

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterUtils.java?rev=1729274&r1=1729273&r2=1729274&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterUtils.java (original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TesterUtils.java Mon Feb  8 21:56:48 2016
@@ -30,8 +30,8 @@ public class TesterUtils {
      */
     public static Object getField(Object target, String fieldName)
             throws Exception {
-        Class<?> clazz = target.getClass();
-        Field f = clazz.getDeclaredField(fieldName);
+        final Class<?> clazz = target.getClass();
+        final Field f = clazz.getDeclaredField(fieldName);
         f.setAccessible(true);
         return f.get(target);
     }




Mime
View raw message