This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new a31c5aac52 Resync code
a31c5aac52 is described below

commit a31c5aac529c30b2736a33c88a7a6442751a7493
Author: remm <[email protected]>
AuthorDate: Sun Oct 25 16:03:11 2026 +0100

    Resync code
    
    The formatting discrepancies are too many to make simple merging
    possible.
    Also fix the test due to missing changes.
---
 .../jdbc/naming/GenericNamingResourcesFactory.java |  12 +--
 .../apache/tomcat/jdbc/pool/ConnectionPool.java    | 114 +++++++++++++--------
 .../org/apache/tomcat/jdbc/pool/DataSource.java    |   4 +-
 .../apache/tomcat/jdbc/pool/DataSourceProxy.java   |  12 +--
 .../apache/tomcat/jdbc/pool/FairBlockingQueue.java |   8 +-
 .../apache/tomcat/jdbc/pool/JdbcInterceptor.java   |   4 +-
 .../jdbc/pool/MultiLockFairBlockingQueue.java      |  12 +--
 .../apache/tomcat/jdbc/pool/PoolProperties.java    |  36 +++----
 .../apache/tomcat/jdbc/pool/PooledConnection.java  |  56 +++++-----
 .../apache/tomcat/jdbc/pool/ProxyConnection.java   |   6 +-
 .../org/apache/tomcat/jdbc/pool/TrapException.java |   2 +-
 .../jdbc/pool/interceptor/AbstractQueryReport.java |   8 +-
 .../jdbc/pool/interceptor/ConnectionState.java     |   6 +-
 .../pool/interceptor/QueryTimeoutInterceptor.java  |   2 +-
 .../jdbc/pool/interceptor/SlowQueryReport.java     |  18 ++--
 .../jdbc/pool/interceptor/SlowQueryReportJmx.java  |  10 +-
 .../jdbc/pool/interceptor/StatementCache.java      |  36 +++----
 .../interceptor/StatementDecoratorInterceptor.java |   8 +-
 .../jdbc/pool/interceptor/StatementFinalizer.java  |   2 +-
 .../tomcat/jdbc/pool/jmx/ConnectionPool.java       |   4 +-
 .../org/apache/tomcat/jdbc/pool/jmx/JmxUtil.java   |   8 +-
 21 files changed, 196 insertions(+), 172 deletions(-)

diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
index a7257fa9c2..a9278eba74 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
@@ -67,7 +67,7 @@ public class GenericNamingResourcesFactory implements 
ObjectFactory {
 
         String type = ref.getClassName();
         Object o =
-            ClassLoaderUtil.loadClass(
+                ClassLoaderUtil.loadClass(
                 type,
                 GenericNamingResourcesFactory.class.getClassLoader(),
                 
Thread.currentThread().getContextClassLoader()).getConstructor().newInstance();
@@ -134,11 +134,11 @@ public class GenericNamingResourcesFactory implements 
ObjectFactory {
                     // Try a setFoo ( long )
                     }else if ("java.lang.Long".equals(paramType.getName())
                                 || "long".equals(paramType.getName())) {
-                            try {
-                                params[0] = Long.valueOf(value);
-                            } catch (NumberFormatException ex) {
-                                ok = false;
-                            }
+                        try {
+                            params[0] = Long.valueOf(value);
+                        } catch (NumberFormatException ex) {
+                            ok = false;
+                        }
 
                         // Try a setFoo ( boolean )
                     } else if ("java.lang.Boolean".equals(paramType.getName())
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
index e4141d9aef..b021fb7d40 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
@@ -178,8 +178,8 @@ public class ConnectionPool {
             Future<PooledConnection> pcf = 
((FairBlockingQueue<PooledConnection>)idle).pollAsync();
             return new ConnectionFuture(pcf);
         } else if (idle instanceof MultiLockFairBlockingQueue<?>) {
-                Future<PooledConnection> pcf = 
((MultiLockFairBlockingQueue<PooledConnection>)idle).pollAsync();
-                return new ConnectionFuture(pcf);
+            Future<PooledConnection> pcf = 
((MultiLockFairBlockingQueue<PooledConnection>)idle).pollAsync();
+            return new ConnectionFuture(pcf);
         } else {
             throw new SQLException("Connection pool is misconfigured, doesn't 
support async retrieval. Set the 'fair' property to 'true'");
         }
@@ -295,7 +295,7 @@ public class ConnectionPool {
         JdbcInterceptor handler = con.getHandler();
         if (handler==null) {
             if (jmxPool != null) {
-              con.createMBean();
+                con.createMBean();
             }
             //build the proxy handler
             handler = new 
ProxyConnection(this,con,getPoolProperties().isUseEquals());
@@ -314,6 +314,8 @@ public class ConnectionPool {
                 }catch(Exception x) {
                     SQLException sx = new SQLException("Unable to instantiate 
interceptor chain.");
                     sx.initCause(x);
+                    //nothing has been done to the connection, it can go back 
to the pool
+                    abandonSetup(con, sx, false);
                     throw sx;
                 }
             }
@@ -321,15 +323,18 @@ public class ConnectionPool {
             con.setHandler(handler);
         }
         //reset the chain in the order the interceptors are declared, for new 
and cached handlers alike
+        JdbcInterceptor next = handler;
         try {
-            JdbcInterceptor next = handler;
             while (next!=null) {
                 next.reset(this, con);
                 next = next.getNext();
             }
         }catch(Exception x) {
-            SQLException sx = new SQLException("Unable to reset interceptor 
chain.");
+            SQLException sx = new SQLException("Unable to reset interceptor [" 
+
+                    (next!=null?next.getClass().getName():"unknown") + "].");
             sx.initCause(x);
+            //the state of the connection is unknown, discard it so its 
partially reset chain is dropped
+            abandonSetup(con, sx, true);
             throw sx;
         }
         // setup statement proxy
@@ -351,11 +356,30 @@ public class ConnectionPool {
         }catch (Exception x) {
             SQLException s = new SQLException();
             s.initCause(x);
+            abandonSetup(con, s, false);
             throw s;
         }
 
     }
 
+    /**
+     * Gives up a connection that was borrowed but could not be set up, so 
that it does not stay borrowed forever.
+     * Any failure to do so is added to the exception that is about to be 
thrown rather than hiding it.
+     * @param con the borrowed connection
+     * @param cause the exception that is about to be thrown to the caller
+     * @param discard {@code true} if the connection must be closed, {@code 
false} if it can go back to the pool
+     */
+    private void abandonSetup(PooledConnection con, SQLException cause, 
boolean discard) {
+        try {
+            if (discard) {
+                con.setDiscarded(true);
+            }
+            returnConnection(con);
+        }catch(Exception y) {
+            cause.addSuppressed(y);
+        }
+    }
+
     /**
      * Creates and caches a {@link java.lang.reflect.Constructor} used to 
instantiate the proxy object.
      * We cache this, since the creation of a constructor is fairly slow.
@@ -392,7 +416,7 @@ public class ConnectionPool {
     protected void close(boolean force) {
         //are we already closed
         if (this.closed) {
-          return;
+            return;
         }
         //prevent other threads from entering
         this.closed = true;
@@ -411,9 +435,9 @@ public class ConnectionPool {
                 while (con != null) {
                     //close the connection
                     if (pool==idle) {
-                      release(con);
+                        release(con);
                     } else {
-                      abandon(con);
+                        abandon(con);
                     }
                     if (!pool.isEmpty()) {
                         con = pool.poll(1000, TimeUnit.MILLISECONDS);
@@ -427,11 +451,11 @@ public class ConnectionPool {
                 }
             }
             if (pool.isEmpty() && force && pool!=busy) {
-              pool = busy;
+                pool = busy;
             }
         }
         if (this.getPoolProperties().isJmxEnabled()) {
-          this.jmxPool = null;
+            this.jmxPool = null;
         }
         PoolProperties.InterceptorDefinition[] proxies = 
getPoolProperties().getJdbcInterceptorsAsArray();
         for (int i=0; i<proxies.length; i++) {
@@ -476,7 +500,7 @@ public class ConnectionPool {
 
         //create JMX MBean
         if (this.getPoolProperties().isJmxEnabled()) {
-          createMBean();
+            createMBean();
         }
 
         //Parse and create an initial set of interceptors. Letting them know 
the pool has started.
@@ -493,7 +517,7 @@ public class ConnectionPool {
             }catch (Exception x) {
                 log.error("Unable to inform interceptor of pool start.",x);
                 if (jmxPool!=null) {
-                  
jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, 
getStackTrace(x));
+                    
jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, 
getStackTrace(x));
                 }
                 close(true);
                 SQLException ex = new SQLException();
@@ -513,7 +537,7 @@ public class ConnectionPool {
             log.error("Unable to create initial connections of pool.", x);
             if (!poolProperties.isIgnoreExceptionOnPreLoad()) {
                 if (jmxPool!=null) {
-                  
jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, 
getStackTrace(x));
+                    
jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_INIT, 
getStackTrace(x));
                 }
                 close(true);
                 throw x;
@@ -601,7 +625,7 @@ public class ConnectionPool {
      */
     protected void abandon(PooledConnection con) {
         if (con == null) {
-          return;
+            return;
         }
         try {
             con.lock();
@@ -630,10 +654,10 @@ public class ConnectionPool {
      */
     protected void suspect(PooledConnection con) {
         if (con == null) {
-          return;
+            return;
         }
         if (con.isSuspect()) {
-          return;
+            return;
         }
         try {
             con.lock();
@@ -656,7 +680,7 @@ public class ConnectionPool {
      */
     protected void release(PooledConnection con) {
         if (con == null) {
-          return;
+            return;
         }
         try {
             con.lock();
@@ -706,7 +730,7 @@ public class ConnectionPool {
                 PooledConnection result = borrowConnection(now, con, username, 
password);
                 borrowedCount.incrementAndGet();
                 if (result!=null) {
-                  return result;
+                    return result;
                 }
             }
 
@@ -784,10 +808,10 @@ public class ConnectionPool {
         //no connections where available we'll create one
         PooledConnection con = create(false);
         if (username!=null) {
-          con.getAttributes().put(PooledConnection.PROP_USER, username);
+            con.getAttributes().put(PooledConnection.PROP_USER, username);
         }
         if (password!=null) {
-          con.getAttributes().put(PooledConnection.PROP_PASSWORD, password);
+            con.getAttributes().put(PooledConnection.PROP_PASSWORD, password);
         }
         boolean error = false;
         try {
@@ -942,12 +966,12 @@ public class ConnectionPool {
                 if (this.getPoolProperties().getRollbackOnReturn()) {
                     boolean autocommit = con.getConnection().getAutoCommit();
                     if (!autocommit) {
-                      con.getConnection().rollback();
+                        con.getConnection().rollback();
                     }
                 } else if (this.getPoolProperties().getCommitOnReturn()) {
                     boolean autocommit = con.getConnection().getAutoCommit();
                     if (!autocommit) {
-                      con.getConnection().commit();
+                        con.getConnection().commit();
                     }
                 }
             }
@@ -967,10 +991,10 @@ public class ConnectionPool {
      */
     protected boolean shouldClose(PooledConnection con, int action) {
         if (con.getConnectionVersion() < getPoolVersion()) {
-          return true;
+            return true;
         }
         if (con.isDiscarded()) {
-          return true;
+            return true;
         }
         try {
             if (con.isClosed()) {
@@ -981,13 +1005,13 @@ public class ConnectionPool {
             return true;
         }
         if (isClosed()) {
-          return true;
+            return true;
         }
         if (!con.validate(action)) {
-          return true;
+            return true;
         }
         if (!terminateTransaction(con)) {
-          return true;
+            return true;
         }
         return false;
     }
@@ -1004,7 +1028,7 @@ public class ConnectionPool {
         if (con.isMaxAgeExpired()) {
             try {
                 if (log.isDebugEnabled()) {
-                  log.debug( "Connection ["+this+"] expired because of maxAge, 
trying to reconnect" );
+                    log.debug( "Connection ["+this+"] expired because of 
maxAge, trying to reconnect" );
                 }
                 con.reconnect();
                 reconnectedCount.incrementAndGet();
@@ -1085,10 +1109,10 @@ public class ConnectionPool {
      */
     protected boolean shouldAbandon() {
         if (!poolProperties.isRemoveAbandoned()) {
-          return false;
+            return false;
         }
         if (poolProperties.getAbandonWhenPercentageFull()==0) {
-          return true;
+            return true;
         }
         float used = busy.size();
         float max  = poolProperties.getMaxActive();
@@ -1102,7 +1126,7 @@ public class ConnectionPool {
     public void checkAbandoned() {
         try {
             if (busy.isEmpty()) {
-              return;
+                return;
             }
             Iterator<PooledConnection> locked = busy.iterator();
             int sto = getPoolProperties().getSuspectTimeout();
@@ -1114,7 +1138,7 @@ public class ConnectionPool {
                     //the con has been returned to the pool or released
                     //ignore it
                     if (idle.contains(con) || con.isReleased()) {
-                      continue;
+                        continue;
                     }
                     long time = con.getTimestamp();
                     long now = System.currentTimeMillis();
@@ -1130,7 +1154,7 @@ public class ConnectionPool {
                 } finally {
                     con.unlock();
                     if (setToNull) {
-                      con = null;
+                        con = null;
                     }
                 }
             } //while
@@ -1162,7 +1186,7 @@ public class ConnectionPool {
 
         try {
             if (idle.isEmpty()) {
-              return;
+                return;
             }
             long now = System.currentTimeMillis();
             Iterator<PooledConnection> unlocked = idle.iterator();
@@ -1173,7 +1197,7 @@ public class ConnectionPool {
                     con.lock();
                     //the con been taken out, we can't clean it up
                     if (busy.contains(con)) {
-                      continue;
+                        continue;
                     }
                     long time = con.getTimestamp();
                     if (shouldReleaseIdle(now, con, time)) {
@@ -1187,7 +1211,7 @@ public class ConnectionPool {
                 } finally {
                     con.unlock();
                     if (setToNull) {
-                      con = null;
+                        con = null;
                     }
                 }
             } //while
@@ -1212,9 +1236,9 @@ public class ConnectionPool {
      */
     protected boolean shouldReleaseIdle(long now, PooledConnection con, long 
time) {
         if (con.getConnectionVersion() < getPoolVersion()) {
-          return true;
+            return true;
         } else {
-          return (con.getReleaseTime()>0) && ((now - time) > 
con.getReleaseTime()) && (getSize()>getPoolProperties().getMinIdle());
+            return (con.getReleaseTime()>0) && ((now - time) > 
con.getReleaseTime()) && (getSize()>getPoolProperties().getMinIdle());
         }
     }
 
@@ -1233,7 +1257,7 @@ public class ConnectionPool {
     public void testAllIdle(boolean checkMaxAgeOnly) {
         try {
             if (idle.isEmpty()) {
-              return;
+                return;
             }
             Iterator<PooledConnection> unlocked = idle.iterator();
             while (unlocked.hasNext()) {
@@ -1242,7 +1266,7 @@ public class ConnectionPool {
                     con.lock();
                     //the con been taken out, we can't clean it up
                     if (busy.contains(con)) {
-                      continue;
+                        continue;
                     }
 
                     boolean release;
@@ -1306,7 +1330,7 @@ public class ConnectionPool {
      */
     protected PooledConnection create(boolean incrementCounter) {
         if (incrementCounter) {
-          size.incrementAndGet();
+            size.incrementAndGet();
         }
         PooledConnection con = new PooledConnection(getPoolProperties(), this);
         return con;
@@ -1514,7 +1538,7 @@ public class ConnectionPool {
             PooledConnection pc = 
this.pc!=null?this.pc:pcFuture.get(timeout,unit);
             if (pc!=null) {
                 if (result!=null) {
-                  return result;
+                    return result;
                 }
                 if (configured.compareAndSet(false, true)) {
                     try {
@@ -1532,7 +1556,7 @@ public class ConnectionPool {
                     latch.await(timeout,unit); //this shouldn't block for long
                 }
                 if (result==null) {
-                  throw new ExecutionException(cause);
+                    throw new ExecutionException(cause);
                 }
                 return result;
             } else {
@@ -1686,11 +1710,11 @@ public class ConnectionPool {
                 try {
                     if (pool.getPoolProperties().isRemoveAbandoned()
                             || pool.getPoolProperties().getSuspectTimeout() > 
0) {
-                      pool.checkAbandoned();
+                        pool.checkAbandoned();
                     }
                     if (pool.getPoolProperties().getMinIdle() < pool.idle
                             .size()) {
-                      pool.checkIdle();
+                        pool.checkIdle();
                     }
                     if (pool.getPoolProperties().isTestWhileIdle()) {
                         pool.testAllIdle(false);
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java
index 5a407bb079..1bdc5e5810 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java
@@ -70,7 +70,7 @@ public class DataSource extends DataSourceProxy implements 
javax.sql.DataSource,
     @Override
     public void postDeregister() {
         if (oname!=null) {
-          unregisterJmx();
+            unregisterJmx();
         }
     }
 
@@ -103,7 +103,7 @@ public class DataSource extends DataSourceProxy implements 
javax.sql.DataSource,
             if ( isJmxEnabled() ) {
                 this.oname = createObjectName(name);
                 if (oname!=null) {
-                  registerJmx();
+                    registerJmx();
                 }
             }
         }catch (MalformedObjectNameException x) {
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
index f3236bd5c9..487a744cef 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
@@ -70,7 +70,7 @@ public class DataSourceProxy implements PoolConfiguration {
      */
     public DataSourceProxy(PoolConfiguration poolProperties) {
         if (poolProperties == null) {
-          throw new NullPointerException("PoolConfiguration cannot be null.");
+            throw new NullPointerException("PoolConfiguration cannot be 
null.");
         }
         this.poolProperties = poolProperties;
     }
@@ -119,7 +119,7 @@ public class DataSourceProxy implements PoolConfiguration {
     public Connection getConnection(String username, String password) throws 
SQLException {
         if (this.getPoolProperties().isAlternateUsernameAllowed()) {
             if (pool == null) {
-              return createPool().getConnection(username,password);
+                return createPool().getConnection(username,password);
             }
             return pool.getConnection(username,password);
         } else {
@@ -174,7 +174,7 @@ public class DataSourceProxy implements PoolConfiguration {
      */
     public Connection getConnection() throws SQLException {
         if (pool == null) {
-          return createPool().getConnection();
+            return createPool().getConnection();
         }
         return pool.getConnection();
     }
@@ -186,7 +186,7 @@ public class DataSourceProxy implements PoolConfiguration {
      */
     public Future<Connection> getConnectionAsync() throws SQLException {
         if (pool == null) {
-          return createPool().getConnectionAsync();
+            return createPool().getConnectionAsync();
         }
         return pool.getConnectionAsync();
     }
@@ -305,9 +305,9 @@ public class DataSourceProxy implements PoolConfiguration {
     public int getPoolSize() {
         final ConnectionPool p = pool;
         if (p == null) {
-          return 0;
+            return 0;
         } else {
-          return p.getSize();
+            return p.getSize();
         }
     }
 
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
index 8b0491a8ec..9dd41e5c1e 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
@@ -101,7 +101,7 @@ public class FairBlockingQueue<E> implements 
BlockingQueue<E> {
                 //give the object to the thread instead of adding it to the 
pool
                 c.setItem(e);
                 if (isLinux) {
-                  c.countDown();
+                    c.countDown();
                 }
             } else {
                 //we always add first, so that the most recently used object 
will be given out
@@ -112,7 +112,7 @@ public class FairBlockingQueue<E> implements 
BlockingQueue<E> {
         }
         //if we exchanged an object with another thread, wake it up.
         if (!isLinux && c!=null) {
-          c.countDown();
+            c.countDown();
         }
         //we have an unbounded queue, so always return true
         return true;
@@ -468,9 +468,9 @@ public class FairBlockingQueue<E> implements 
BlockingQueue<E> {
             } else if (latch!=null) {
                 boolean timedout = !latch.await(timeout, unit);
                 if (timedout) {
-                  throw new TimeoutException();
+                    throw new TimeoutException();
                 } else {
-                  return latch.getItem();
+                    return latch.getItem();
                 }
             } else {
                 throw new ExecutionException("ItemFuture incorrectly 
instantiated. Bug in the code?", new Exception());
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
index 0baa5845ca..5c7e27bb47 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java
@@ -104,9 +104,9 @@ public abstract class JdbcInterceptor implements 
InvocationHandler {
     @Override
     public Object invoke(Object proxy, Method method, Object[] args) throws 
Throwable {
         if (getNext()!=null) {
-          return getNext().invoke(proxy,method,args);
+            return getNext().invoke(proxy,method,args);
         } else {
-          throw new NullPointerException();
+            throw new NullPointerException();
         }
     }
 
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java
index a9f530edfd..4b78617b45 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java
@@ -129,7 +129,7 @@ public class MultiLockFairBlockingQueue<E> implements 
BlockingQueue<E> {
         }
         //if we exchanged an object with another thread, wake it up.
         if (c!=null) {
-          c.countDown();
+            c.countDown();
         }
         //we have an unbounded queue, so always return true
         return true;
@@ -225,7 +225,7 @@ public class MultiLockFairBlockingQueue<E> implements 
BlockingQueue<E> {
             try {
                 boolean result = items[idx].remove(e);
                 if (result) {
-                  return result;
+                    return result;
                 }
             } finally {
                 lock.unlock();
@@ -265,7 +265,7 @@ public class MultiLockFairBlockingQueue<E> implements 
BlockingQueue<E> {
         for (int idx=0; idx<LOCK_COUNT; idx++) {
             boolean result = items[idx].contains(e);
             if (result) {
-              return result;
+                return result;
             }
         }
         return false;
@@ -467,9 +467,9 @@ public class MultiLockFairBlockingQueue<E> implements 
BlockingQueue<E> {
             } else if (latch!=null) {
                 boolean timedout = !latch.await(timeout, unit);
                 if (timedout) {
-                  throw new TimeoutException();
+                    throw new TimeoutException();
                 } else {
-                  return latch.getItem();
+                    return latch.getItem();
                 }
             } else {
                 throw new ExecutionException("ItemFuture incorrectly 
instantiated. Bug in the code?", new Exception());
@@ -578,7 +578,7 @@ public class MultiLockFairBlockingQueue<E> implements 
BlockingQueue<E> {
                 try {
                     boolean result = 
MultiLockFairBlockingQueue.this.items[idx].remove(elements[index]);
                     if (result) {
-                      break;
+                        break;
                     }
                 } finally {
                     lock.unlock();
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
index e7e87a0a94..dec13f524c 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
@@ -162,11 +162,11 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
     @Override
     public void setAbandonWhenPercentageFull(int percentage) {
         if (percentage<0) {
-          abandonWhenPercentageFull = 0;
+            abandonWhenPercentageFull = 0;
         } else if (percentage>100) {
-          abandonWhenPercentageFull = 100;
+            abandonWhenPercentageFull = 100;
         } else {
-          abandonWhenPercentageFull = percentage;
+            abandonWhenPercentageFull = percentage;
         }
     }
 
@@ -628,9 +628,9 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
         try {
             @SuppressWarnings("unchecked")
             Class<Validator> validatorClass = 
(Class<Validator>)ClassLoaderUtil.loadClass(
-                className,
-                PoolProperties.class.getClassLoader(),
-                Thread.currentThread().getContextClassLoader()
+                    className,
+                    PoolProperties.class.getClassLoader(),
+                    Thread.currentThread().getContextClassLoader()
             );
             validator = validatorClass.getConstructor().newInstance();
         } catch (ClassNotFoundException e) {
@@ -906,13 +906,13 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
          */
         public boolean getValueAsBoolean(boolean def) {
             if (value==null) {
-              return def;
+                return def;
             }
             if ("true".equals(value)) {
-              return true;
+                return true;
             }
             if ("false".equals(value)) {
-              return false;
+                return false;
             }
             return def;
         }
@@ -924,7 +924,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
          */
         public int getValueAsInt(int def) {
             if (value==null) {
-              return def;
+                return def;
             }
             try {
                 int v = Integer.parseInt(value);
@@ -941,7 +941,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
          */
         public long getValueAsLong(long def) {
             if (value==null) {
-              return def;
+                return def;
             }
             try {
                 return Long.parseLong(value);
@@ -957,7 +957,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
          */
         public byte getValueAsByte(byte def) {
             if (value==null) {
-              return def;
+                return def;
             }
             try {
                 return Byte.parseByte(value);
@@ -973,7 +973,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
          */
         public short getValueAsShort(short def) {
             if (value==null) {
-              return def;
+                return def;
             }
             try {
                 return Short.parseShort(value);
@@ -989,7 +989,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
          */
         public float getValueAsFloat(float def) {
             if (value==null) {
-              return def;
+                return def;
             }
             try {
                 return Float.parseFloat(value);
@@ -1005,7 +1005,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
          */
         public double getValueAsDouble(double def) {
             if (value==null) {
-              return def;
+                return def;
             }
             try {
                 return Double.parseDouble(value);
@@ -1021,7 +1021,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
          */
         public char getValueAschar(char def) {
             if (value==null) {
-              return def;
+                return def;
             }
             try {
                 return value.charAt(0);
@@ -1038,7 +1038,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
         @Override
         public boolean equals(Object o) {
             if (o==this) {
-              return true;
+                return true;
             }
             if (o instanceof InterceptorProperty) {
                 InterceptorProperty other = (InterceptorProperty)o;
@@ -1118,7 +1118,7 @@ public class PoolProperties implements PoolConfiguration, 
Cloneable, Serializabl
      */
     public static Properties getProperties(String propText, Properties props) {
         if (props==null) {
-          props = new Properties();
+            props = new Properties();
         }
         if (propText != null) {
             try {
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
index b8bebf5edc..1bce6d72cd 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
@@ -171,14 +171,14 @@ public class PooledConnection implements 
PooledConnectionMBean {
     public boolean shouldForceReconnect(String username, String password) {
 
         if (!getPoolProperties().isAlternateUsernameAllowed()) {
-          return false;
+            return false;
         }
 
         if (username==null) {
-          username = poolProperties.getUsername();
+            username = poolProperties.getUsername();
         }
         if (password==null) {
-          password = poolProperties.getPassword();
+            password = poolProperties.getPassword();
         }
 
         String storedUsr = (String)getAttributes().get(PROP_USER);
@@ -190,14 +190,14 @@ public class PooledConnection implements 
PooledConnectionMBean {
         noChangeInCredentials = noChangeInCredentials && ((password==null && 
storedPwd==null) || (password!=null && password.equals(storedPwd)));
 
         if (username==null) {
-          getAttributes().remove(PROP_USER);
+            getAttributes().remove(PROP_USER);
         } else {
-          getAttributes().put(PROP_USER, username);
+            getAttributes().put(PROP_USER, username);
         }
         if (password==null) {
-          getAttributes().remove(PROP_PASSWORD);
+            getAttributes().remove(PROP_PASSWORD);
         } else {
-          getAttributes().put(PROP_PASSWORD, password);
+            getAttributes().put(PROP_PASSWORD, password);
         }
 
         return !noChangeInCredentials;
@@ -214,7 +214,7 @@ public class PooledConnection implements 
PooledConnectionMBean {
      */
     public void connect() throws SQLException {
         if (released.get()) {
-          throw new SQLException("A connection once released, can't be 
reestablished.");
+            throw new SQLException("A connection once released, can't be 
reestablished.");
         }
         if (connection != null) {
             try {
@@ -239,16 +239,16 @@ public class PooledConnection implements 
PooledConnectionMBean {
         if (poolProperties.getJdbcInterceptors()==null || 
poolProperties.getJdbcInterceptors().indexOf(ConnectionState.class.getName())<0 
||
                 
poolProperties.getJdbcInterceptors().indexOf(ConnectionState.class.getSimpleName())<0)
 {
             if 
(poolProperties.getDefaultTransactionIsolation()!=DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION)
 {
-              
connection.setTransactionIsolation(poolProperties.getDefaultTransactionIsolation());
+                
connection.setTransactionIsolation(poolProperties.getDefaultTransactionIsolation());
             }
             if (poolProperties.getDefaultReadOnly()!=null) {
-              
connection.setReadOnly(poolProperties.getDefaultReadOnly().booleanValue());
+                
connection.setReadOnly(poolProperties.getDefaultReadOnly().booleanValue());
             }
             if (poolProperties.getDefaultAutoCommit()!=null) {
-              
connection.setAutoCommit(poolProperties.getDefaultAutoCommit().booleanValue());
+                
connection.setAutoCommit(poolProperties.getDefaultAutoCommit().booleanValue());
             }
             if (poolProperties.getDefaultCatalog()!=null) {
-              connection.setCatalog(poolProperties.getDefaultCatalog());
+                connection.setCatalog(poolProperties.getDefaultCatalog());
             }
         }
         this.discarded = false;
@@ -351,10 +351,10 @@ public class PooledConnection implements 
PooledConnectionMBean {
         }
         Properties properties = 
PoolUtilities.clone(poolProperties.getDbProperties());
         if (usr != null) {
-          properties.setProperty(PROP_USER, usr);
+            properties.setProperty(PROP_USER, usr);
         }
         if (pwd != null) {
-          properties.setProperty(PROP_PASSWORD, pwd);
+            properties.setProperty(PROP_PASSWORD, pwd);
         }
 
         try {
@@ -443,7 +443,7 @@ public class PooledConnection implements 
PooledConnectionMBean {
         xaConnection = null;
         lastConnected = -1;
         if (finalize) {
-          parent.finalize(this);
+            parent.finalize(this);
         }
     }
 
@@ -471,17 +471,17 @@ public class PooledConnection implements 
PooledConnectionMBean {
      */
     private boolean doValidate(int action) {
         if (action == VALIDATE_BORROW && poolProperties.isTestOnBorrow()) {
-          return true;
+            return true;
         } else if (action == VALIDATE_RETURN && 
poolProperties.isTestOnReturn()) {
-          return true;
+            return true;
         } else if (action == VALIDATE_IDLE && 
poolProperties.isTestWhileIdle()) {
-          return true;
+            return true;
         } else if (action == VALIDATE_INIT && 
poolProperties.isTestOnConnect()) {
-          return true;
+            return true;
         } else if (action == VALIDATE_INIT && 
poolProperties.getInitSQL()!=null) {
-          return true;
+            return true;
         } else {
-          return false;
+            return false;
         }
     }
 
@@ -522,9 +522,9 @@ public class PooledConnection implements 
PooledConnectionMBean {
         //Don't bother validating if already have recently enough
         long now = System.currentTimeMillis();
         if (validateAction!=VALIDATE_INIT &&
-            poolProperties.getValidationInterval() > 0 &&
-            (now - this.lastValidated) <
-            poolProperties.getValidationInterval()) {
+                poolProperties.getValidationInterval() > 0 &&
+                (now - this.lastValidated) <
+                poolProperties.getValidationInterval()) {
             return true;
         }
 
@@ -554,7 +554,7 @@ public class PooledConnection implements 
PooledConnectionMBean {
             boolean transactionCommitted = false;
             int validationQueryTimeout = 
poolProperties.getValidationQueryTimeout();
             if (validationQueryTimeout < 0) {
-              validationQueryTimeout = 0;
+                validationQueryTimeout = 0;
             }
             try {
                 if (connection.isValid(validationQueryTimeout)) {
@@ -603,7 +603,7 @@ public class PooledConnection implements 
PooledConnectionMBean {
                 log.debug("Unable to validate object:",ex);
             }
             if (stmt!=null) {
-              try { stmt.close();} catch (Exception ignore2){/*NOOP*/}
+                try { stmt.close();} catch (Exception ignore2){/*NOOP*/}
             }
 
         } finally {
@@ -722,7 +722,7 @@ public class PooledConnection implements 
PooledConnectionMBean {
      */
     public void setDiscarded(boolean discarded) {
         if (this.discarded && !discarded) {
-          throw new IllegalStateException("Unable to change the state once the 
connection has been discarded");
+            throw new IllegalStateException("Unable to change the state once 
the connection has been discarded");
         }
         this.discarded = discarded;
     }
@@ -885,7 +885,7 @@ public class PooledConnection implements 
PooledConnectionMBean {
      */
     public void createMBean() {
         if (oname != null) {
-          return;
+            return;
         }
         String keyprop = 
",connections=PooledConnection["+connectionIndex.getAndIncrement()+"]";
         oname = JmxUtil.registerJmx(parent.getJmxPool().getObjectName(), 
keyprop, this);
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java
index b77f513fee..51bb5744e2 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java
@@ -130,8 +130,8 @@ public class ProxyConnection extends JdbcInterceptor {
         }
         if (compare(CLOSE_VAL,method)) {
             if (connection==null)
-             {
-              return null; //noop for already closed.
+            {
+                return null; //noop for already closed.
             }
             PooledConnection poolc = this.connection;
             this.connection = null;
@@ -153,7 +153,7 @@ public class ProxyConnection extends JdbcInterceptor {
             }
         }
         if (isClosed()) {
-          throw new SQLException("Connection has already been closed.");
+            throw new SQLException("Connection has already been closed.");
         }
         if (compare(UNWRAP_VAL,method)) {
             return unwrap((Class<?>)args[0]);
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java
index e5ad0cbc14..131fe1cee7 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java
@@ -76,7 +76,7 @@ public class TrapException extends JdbcInterceptor {
     public boolean isDeclaredException(Method m, Class<?> clazz) {
         for (Class<?> cl : m.getExceptionTypes()) {
             if (cl.equals(clazz) || cl.isAssignableFrom(clazz)) {
-              return true;
+                return true;
             }
         }
         return false;
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
index a45e9e0406..1171e65a91 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
@@ -211,15 +211,15 @@ public abstract class AbstractQueryReport extends 
AbstractCreateStatementInterce
             boolean close = compare(CLOSE_VAL, name);
             //allow close to be called multiple times
             if (close && closed) {
-              return null;
+                return null;
             }
             //are we calling isClosed?
             if (compare(ISCLOSED_VAL, name)) {
-              return Boolean.valueOf(closed);
+                return Boolean.valueOf(closed);
             }
             //if we are calling anything else, bail out
             if (closed) {
-              throw new SQLException("Statement closed.");
+                throw new SQLException("Statement closed.");
             }
             boolean process = false;
             //check to see if we are about to execute a query
@@ -248,7 +248,7 @@ public abstract class AbstractQueryReport extends 
AbstractCreateStatementInterce
                     reportSlowQuery(query, args, name, start, delta);
                 }catch (Exception t) {
                     if (log.isWarnEnabled()) {
-                      log.warn("Unable to process slow query",t);
+                        log.warn("Unable to process slow query",t);
                     }
                 }
             } else if (process) {
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
index 2b645e5934..3f2939d49d 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
@@ -159,14 +159,14 @@ public class ConnectionState extends JdbcInterceptor  {
         for (int i=0; (!read) && i<readState.length; i++) {
             read = compare(name,readState[i]);
             if (read) {
-              index = i;
+                index = i;
             }
         }
         boolean write = false;
         for (int i=0; (!write) && (!read) && i<writeState.length; i++) {
             write = compare(name,writeState[i]);
             if (write) {
-              index = i;
+                index = i;
             }
         }
         Object result = null;
@@ -180,7 +180,7 @@ public class ConnectionState extends JdbcInterceptor  {
             }
             //return cached result, if we have it
             if (result!=null) {
-              return result;
+                return result;
             }
         }
 
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/QueryTimeoutInterceptor.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/QueryTimeoutInterceptor.java
index 82e1e1f1c7..5f7c9846d4 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/QueryTimeoutInterceptor.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/QueryTimeoutInterceptor.java
@@ -53,7 +53,7 @@ public class QueryTimeoutInterceptor extends 
AbstractCreateStatementInterceptor
         super.setProperties(properties);
         InterceptorProperty p = properties.get("queryTimeout");
         if (p!=null) {
-          timeout = p.getValueAsInt(timeout);
+            timeout = p.getValueAsInt(timeout);
         }
     }
 
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
index 0eeaed3e1a..55b2121a25 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
@@ -48,7 +48,7 @@ public class SlowQueryReport extends AbstractQueryReport  {
      * we will be keeping track of query stats on a per pool basis
      */
     protected static final 
ConcurrentHashMap<String,ConcurrentHashMap<String,QueryStats>> perPoolStats =
-        new ConcurrentHashMap<>();
+            new ConcurrentHashMap<>();
     /**
      * the queries that are used for this interceptor.
      */
@@ -122,7 +122,7 @@ public class SlowQueryReport extends AbstractQueryReport  {
         if (this.maxQueries > 0 ) {
             QueryStats qs = this.getQueryStats(sql);
             if (qs != null) {
-              qs.add(delta, start);
+                qs.add(delta, start);
             }
         }
         return sql;
@@ -163,7 +163,7 @@ public class SlowQueryReport extends AbstractQueryReport  {
         if (this.maxQueries > 0 ) {
             QueryStats qs = getQueryStats(sql);
             if (qs != null) {
-              qs.prepare(time);
+                qs.prepare(time);
             }
         }
     }
@@ -179,7 +179,7 @@ public class SlowQueryReport extends AbstractQueryReport  {
         if (this.maxQueries > 0 ) {
             QueryStats qs = getQueryStats(sql);
             if (qs != null) {
-              qs.prepare(time);
+                qs.prepare(time);
             }
         }
     }
@@ -225,12 +225,12 @@ public class SlowQueryReport extends AbstractQueryReport  
{
      */
     protected QueryStats getQueryStats(String sql) {
         if (sql==null) {
-          sql = "";
+            sql = "";
         }
         ConcurrentHashMap<String,QueryStats> queries = 
SlowQueryReport.this.queries;
         if (queries==null) {
             if (log.isWarnEnabled()) {
-              log.warn("Connection has already been closed or abandoned");
+                log.warn("Connection has already been closed or abandoned");
             }
             return null;
         }
@@ -261,7 +261,7 @@ public class SlowQueryReport extends AbstractQueryReport  {
             String sql = list.get(removeIndex).getQuery();
             queries.remove(sql);
             if (log.isDebugEnabled()) {
-              log.debug("Removing slow query, capacity reached:"+sql);
+                log.debug("Removing slow query, capacity reached:"+sql);
             }
             removeIndex++;
         }
@@ -278,9 +278,9 @@ public class SlowQueryReport extends AbstractQueryReport  {
     public void reset(ConnectionPool parent, PooledConnection con) {
         super.reset(parent, con);
         if (parent!=null) {
-          queries = perPoolStats.get(parent.getName());
+            queries = perPoolStats.get(parent.getName());
         } else {
-          queries = null;
+            queries = null;
         }
     }
 
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java
index ea7886a9a4..ab238cbf0f 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java
@@ -81,7 +81,7 @@ public class SlowQueryReportJmx extends SlowQueryReport 
implements NotificationE
      * Registry of JMX MBeans for each connection pool.
      */
     protected static final ConcurrentHashMap<String,SlowQueryReportJmxMBean> 
mbeans =
-        new ConcurrentHashMap<>();
+            new ConcurrentHashMap<>();
 
 
     //==============================JMX STUFF========================
@@ -230,7 +230,7 @@ public class SlowQueryReportJmx extends SlowQueryReport 
implements NotificationE
     protected String reportFailedQuery(String query, Object[] args, String 
name, long start, Throwable t) {
         query = super.reportFailedQuery(query, args, name, start, t);
         if (isLogFailed()) {
-          notifyJmx(query,FAILED_QUERY_NOTIFICATION);
+            notifyJmx(query,FAILED_QUERY_NOTIFICATION);
         }
         return query;
     }
@@ -251,7 +251,7 @@ public class SlowQueryReportJmx extends SlowQueryReport 
implements NotificationE
             } else {
                 if (notifier!=null) {
                     Notification notification =
-                        new Notification(type,
+                            new Notification(type,
                                          this,
                                          sequence,
                                          System.currentTimeMillis(),
@@ -280,7 +280,7 @@ public class SlowQueryReportJmx extends SlowQueryReport 
implements NotificationE
     protected String reportSlowQuery(String query, Object[] args, String name, 
long start, long delta) {
         query = super.reportSlowQuery(query, args, name, start, delta);
         if (isLogSlow()) {
-          notifyJmx(query,SLOW_QUERY_NOTIFICATION);
+            notifyJmx(query,SLOW_QUERY_NOTIFICATION);
         }
         return query;
     }
@@ -327,7 +327,7 @@ public class SlowQueryReportJmx extends SlowQueryReport 
implements NotificationE
         if (queries!=null) {
             Iterator<String> it = queries.keySet().iterator();
             while (it.hasNext()) {
-              it.remove();
+                it.remove();
             }
         }
     }
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementCache.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementCache.java
index a6a2db467a..19a141efa4 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementCache.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementCache.java
@@ -114,15 +114,15 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
         super.setProperties(properties);
         InterceptorProperty p = properties.get("prepared");
         if (p!=null) {
-          cachePrepared = p.getValueAsBoolean(cachePrepared);
+            cachePrepared = p.getValueAsBoolean(cachePrepared);
         }
         p = properties.get("callable");
         if (p!=null) {
-          cacheCallable = p.getValueAsBoolean(cacheCallable);
+            cacheCallable = p.getValueAsBoolean(cacheCallable);
         }
         p = properties.get("max");
         if (p!=null) {
-          maxCacheSize = p.getValueAsInt(maxCacheSize);
+            maxCacheSize = p.getValueAsInt(maxCacheSize);
         }
         if (cachePrepared && cacheCallable) {
             this.types = ALL_TYPES;
@@ -139,7 +139,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
 
     /*begin the cache size*/
     private static ConcurrentHashMap<ConnectionPool,AtomicInteger> 
cacheSizeMap =
-        new ConcurrentHashMap<>();
+            new ConcurrentHashMap<>();
 
     private AtomicInteger cacheSize;
 
@@ -186,7 +186,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
     public void disconnected(ConnectionPool parent, PooledConnection con, 
boolean finalizing) {
         @SuppressWarnings("unchecked")
         ConcurrentHashMap<CacheKey,CachedStatement> statements =
-            
(ConcurrentHashMap<CacheKey,CachedStatement>)con.getAttributes().get(STATEMENT_CACHE_ATTR);
+                
(ConcurrentHashMap<CacheKey,CachedStatement>)con.getAttributes().get(STATEMENT_CACHE_ATTR);
 
         if (statements!=null) {
             for (Map.Entry<CacheKey, CachedStatement> p : 
statements.entrySet()) {
@@ -205,7 +205,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
      */
     public void closeStatement(CachedStatement st) {
         if (st==null) {
-          return;
+            return;
         }
         st.forceClose();
     }
@@ -213,7 +213,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
     @Override
     protected Object createDecorator(Object proxy, Method method, Object[] 
args,
                                      Object statement, Constructor<?> 
constructor, String sql)
-    throws InstantiationException, IllegalAccessException, 
InvocationTargetException {
+        throws InstantiationException, IllegalAccessException, 
InvocationTargetException {
         boolean process = process(this.types, method, false);
         if (process) {
             Object result = null;
@@ -256,7 +256,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
     public CachedStatement isCached(Method method, Object[] args) {
         ConcurrentHashMap<CacheKey,CachedStatement> cache = getCache();
         if (cache == null) {
-          return null;
+            return null;
         }
         CacheKey key = createCacheKey(method, args);
         if (key == null) {
@@ -274,7 +274,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
     public boolean cacheStatement(CachedStatement proxy) {
         ConcurrentHashMap<CacheKey,CachedStatement> cache = getCache();
         if (cache == null) {
-          return false;
+            return false;
         }
         if (proxy.getCacheKey()==null) {
             return false;
@@ -301,7 +301,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
     public boolean removeStatement(CachedStatement proxy) {
         ConcurrentHashMap<CacheKey,CachedStatement> cache = getCache();
         if (cache == null) {
-          return false;
+            return false;
         }
         if (cache.remove(proxy.getCacheKey()) != null) {
             cacheSize.decrementAndGet();
@@ -321,7 +321,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
         PooledConnection pCon = this.pcon;
         if (pCon == null) {
             if (log.isWarnEnabled()) {
-              log.warn("Connection has already been closed or abandoned");
+                log.warn("Connection has already been closed or abandoned");
             }
             return null;
         }
@@ -335,7 +335,7 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
     public int getCacheSizePerConnection() {
         ConcurrentHashMap<CacheKey,CachedStatement> cache = getCache();
         if (cache == null) {
-          return 0;
+            return 0;
         }
         return cache.size();
     }
@@ -501,24 +501,24 @@ public class StatementCache extends 
StatementDecoratorInterceptor implements Sta
         @Override
         public boolean equals(Object obj) {
             if (this == obj) {
-              return true;
+                return true;
             }
             if (obj == null) {
-              return false;
+                return false;
             }
             if (getClass() != obj.getClass()) {
-              return false;
+                return false;
             }
             CacheKey other = (CacheKey) obj;
             if (!Arrays.deepEquals(args, other.args)) {
-              return false;
+                return false;
             }
             if (stmtType == null) {
                 if (other.stmtType != null) {
-                  return false;
+                    return false;
                 }
             } else if (!stmtType.equals(other.stmtType)) {
-              return false;
+                return false;
             }
             return true;
         }
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
index b9f753a88d..26194fe024 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
@@ -149,7 +149,7 @@ public class StatementDecoratorInterceptor extends 
AbstractCreateStatementInterc
      */
     protected Object createDecorator(Object proxy, Method method, Object[] 
args,
                                      Object statement, Constructor<?> 
constructor, String sql)
-    throws InstantiationException, IllegalAccessException, 
InvocationTargetException {
+        throws InstantiationException, IllegalAccessException, 
InvocationTargetException {
         Object result = null;
         StatementProxy<Statement> statementProxy =
                 new StatementProxy<>((Statement)statement,sql);
@@ -301,15 +301,15 @@ public class StatementDecoratorInterceptor extends 
AbstractCreateStatementInterc
             boolean close = compare(CLOSE_VAL, method);
             // allow close to be called multiple times
             if (close && closed) {
-              return null;
+                return null;
             }
             // are we calling isClosed?
             if (compare(ISCLOSED_VAL, method)) {
-              return Boolean.valueOf(closed);
+                return Boolean.valueOf(closed);
             }
             // if we are calling anything else, bail out
             if (closed) {
-              throw new SQLException("Statement closed.");
+                throw new SQLException("Statement closed.");
             }
             if (compare(GETCONNECTION_VAL,method)){
                 return connection;
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java
index 97023f8d24..84843ff395 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java
@@ -54,7 +54,7 @@ public class StatementFinalizer extends 
AbstractCreateStatementInterceptor {
     public Object createStatement(Object proxy, Method method, Object[] args, 
Object statement, long time) {
         try {
             if (statement instanceof Statement) {
-              statements.add(new StatementEntry((Statement)statement));
+                statements.add(new StatementEntry((Statement)statement));
             }
         }catch (ClassCastException x) {
             //ignore this one
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
index ac39b0a824..d1169824cd 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
@@ -165,10 +165,10 @@ public class ConnectionPool extends 
NotificationBroadcasterSupport
         MBeanNotificationInfo[] loc = getDefaultNotificationInfo();
         MBeanNotificationInfo[] aug = new MBeanNotificationInfo[pres.length + 
loc.length];
         if (pres.length>0) {
-          System.arraycopy(pres, 0, aug, 0, pres.length);
+            System.arraycopy(pres, 0, aug, 0, pres.length);
         }
         if (loc.length >0) {
-          System.arraycopy(loc, 0, aug, pres.length, loc.length);
+            System.arraycopy(loc, 0, aug, pres.length, loc.length);
         }
         return aug;
     }
diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/JmxUtil.java 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/JmxUtil.java
index 2a70021e7e..d3dc0e475d 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/JmxUtil.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/JmxUtil.java
@@ -51,7 +51,7 @@ public class JmxUtil {
         try {
             oname = getObjectName(base, keyprop);
             if (oname != null) {
-              ManagementFactory.getPlatformMBeanServer().registerMBean(obj, 
oname);
+                ManagementFactory.getPlatformMBeanServer().registerMBean(obj, 
oname);
             }
         } catch (Exception e) {
             log.error("Jmx registration failed.",e);
@@ -66,7 +66,7 @@ public class JmxUtil {
      */
     public static void unregisterJmx(ObjectName oname) {
         if (oname ==null) {
-          return;
+            return;
         }
         try {
             ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname);
@@ -78,11 +78,11 @@ public class JmxUtil {
     private static ObjectName getObjectName(ObjectName base, String keyprop)
             throws MalformedObjectNameException {
         if (base == null) {
-          return null;
+            return null;
         }
         StringBuilder OnameStr = new StringBuilder(base.toString());
         if (keyprop != null) {
-          OnameStr.append(keyprop);
+            OnameStr.append(keyprop);
         }
         ObjectName oname = new ObjectName(OnameStr.toString());
         return oname;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to