You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/04/18 14:35:46 UTC

[commons-dbcp] branch master updated: Format: "catch(" -> "catch ("

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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git


The following commit(s) were added to refs/heads/master by this push:
     new bb18eaac Format: "catch(" -> "catch ("
bb18eaac is described below

commit bb18eaace739db107e156d8ec8e929d4a1aa1445
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Apr 18 10:35:41 2023 -0400

    Format: "catch(" -> "catch ("
---
 doc/BasicDataSourceExample.java                      | 20 ++++++++++++++++----
 doc/PoolingDataSourceExample.java                    | 20 ++++++++++++++++----
 doc/PoolingDriverExample.java                        | 20 ++++++++++++++++----
 .../apache/commons/dbcp2/TestBasicDataSource.java    |  2 +-
 .../org/apache/commons/dbcp2/TestConnectionPool.java | 10 +++++-----
 .../dbcp2/TestParallelCreationWithNoIdle.java        |  2 +-
 .../java/org/apache/commons/dbcp2/TesterDriver.java  |  2 +-
 7 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/doc/BasicDataSourceExample.java b/doc/BasicDataSourceExample.java
index 81b6e389..303eb46d 100644
--- a/doc/BasicDataSourceExample.java
+++ b/doc/BasicDataSourceExample.java
@@ -99,12 +99,24 @@ public class BasicDataSourceExample {
                 }
                 System.out.println("");
             }
-        } catch(SQLException e) {
+        } catch (SQLException e) {
             e.printStackTrace();
         } finally {
-            try { if (rset != null) rset.close(); } catch(Exception e) { }
-            try { if (stmt != null) stmt.close(); } catch(Exception e) { }
-            try { if (conn != null) conn.close(); } catch(Exception e) { }
+            try {
+                if (rset != null)
+                    rset.close();
+            } catch (Exception e) {
+            }
+            try {
+                if (stmt != null)
+                    stmt.close();
+            } catch (Exception e) {
+            }
+            try {
+                if (conn != null)
+                    conn.close();
+            } catch (Exception e) {
+            }
         }
     }
 
diff --git a/doc/PoolingDataSourceExample.java b/doc/PoolingDataSourceExample.java
index 2a12c748..13227129 100644
--- a/doc/PoolingDataSourceExample.java
+++ b/doc/PoolingDataSourceExample.java
@@ -120,12 +120,24 @@ public class PoolingDataSourceExample {
                 }
                 System.out.println("");
             }
-        } catch(SQLException e) {
+        } catch (SQLException e) {
             e.printStackTrace();
         } finally {
-            try { if (rset != null) rset.close(); } catch(Exception e) { }
-            try { if (stmt != null) stmt.close(); } catch(Exception e) { }
-            try { if (conn != null) conn.close(); } catch(Exception e) { }
+            try {
+                if (rset != null)
+                    rset.close();
+            } catch (Exception e) {
+            }
+            try {
+                if (stmt != null)
+                    stmt.close();
+            } catch (Exception e) {
+            }
+            try {
+                if (conn != null)
+                    conn.close();
+            } catch (Exception e) {
+            }
         }
     }
 
diff --git a/doc/PoolingDriverExample.java b/doc/PoolingDriverExample.java
index 8fd8ec50..cc96d775 100644
--- a/doc/PoolingDriverExample.java
+++ b/doc/PoolingDriverExample.java
@@ -121,12 +121,24 @@ public class PoolingDriverExample {
                 }
                 System.out.println("");
             }
-        } catch(SQLException e) {
+        } catch (SQLException e) {
             e.printStackTrace();
         } finally {
-            try { if (rset != null) rset.close(); } catch(Exception e) { }
-            try { if (stmt != null) stmt.close(); } catch(Exception e) { }
-            try { if (conn != null) conn.close(); } catch(Exception e) { }
+            try {
+                if (rset != null)
+                    rset.close();
+            } catch (Exception e) {
+            }
+            try {
+                if (stmt != null)
+                    stmt.close();
+            } catch (Exception e) {
+            }
+            try {
+                if (conn != null)
+                    conn.close();
+            } catch (Exception e) {
+            }
         }
 
         // Display some pool statistics
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
index dd99ae0e..aa1d18d0 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
@@ -1159,7 +1159,7 @@ class TesterConnectionDelayDriver extends TesterDriver {
         final int delay = Integer.parseInt(parsedUrl[parsedUrl.length - 1]);
         try {
             Thread.sleep(delay);
-        } catch(final InterruptedException ex) {
+        } catch (final InterruptedException ex) {
             Thread.currentThread().interrupt();
         }
         return super.connect(url, info);
diff --git a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
index f100ad06..76201f17 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
@@ -197,7 +197,7 @@ public abstract class TestConnectionPool {
             for(int i=0;i<_iter;i++) {
                 try {
                     Thread.sleep(_random.nextInt(_delay));
-                } catch(final Exception e) {
+                } catch (final Exception e) {
                     // ignored
                 }
                 try (Connection conn = newConnection();
@@ -206,10 +206,10 @@ public abstract class TestConnectionPool {
                         ResultSet rset = stmt.executeQuery()) {
                     try {
                         Thread.sleep(_random.nextInt(_delay));
-                    } catch(final Exception e) {
+                    } catch (final Exception e) {
                         // ignored
                     }
-                } catch(final Exception e) {
+                } catch (final Exception e) {
                     e.printStackTrace();
                     _failed = true;
                     _complete = true;
@@ -916,7 +916,7 @@ public abstract class TestConnectionPool {
         conn.close();
         try (Statement s = conn.createStatement()){
             fail("Can't use closed connections");
-        } catch(final SQLException e) {
+        } catch (final SQLException e) {
             // expected
         }
 
@@ -956,7 +956,7 @@ public abstract class TestConnectionPool {
             while(!threads[i].complete()) {
                 try {
                     Thread.sleep(100L);
-                } catch(final Exception e) {
+                } catch (final Exception e) {
                     // ignored
                 }
             }
diff --git a/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java b/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
index f5317338..f1ae1502 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestParallelCreationWithNoIdle.java
@@ -78,7 +78,7 @@ public class TestParallelCreationWithNoIdle  {
             }
             try {
                 Thread.sleep(_random.nextInt(timeMax));
-            } catch(final Exception e) {
+            } catch (final Exception e) {
                 // ignored
             }
         }
diff --git a/src/test/java/org/apache/commons/dbcp2/TesterDriver.java b/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
index 3295ecc1..adf3b8c3 100644
--- a/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
+++ b/src/test/java/org/apache/commons/dbcp2/TesterDriver.java
@@ -44,7 +44,7 @@ public class TesterDriver implements Driver {
     static {
         try {
             DriverManager.registerDriver(new TesterDriver());
-        } catch(final Exception e) {
+        } catch (final Exception e) {
             // ignore
         }
         validUserPasswords.put("foo", "bar");