commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r895869 - in /commons/proper/dbcp/trunk: src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java xdocs/changes.xml
Date Tue, 05 Jan 2010 03:03:47 GMT
Author: sebb
Date: Tue Jan  5 03:03:44 2010
New Revision: 895869

URL: http://svn.apache.org/viewvc?rev=895869&view=rev
Log:
DBCP-313 Remove code that catches and ignores Exceptions when calling
PooledConnection.removeConnectionEventListener(ConnectionEventListener)
as the method does not throw any Exceptions.

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
    commons/proper/dbcp/trunk/xdocs/changes.xml

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java?rev=895869&r1=895868&r2=895869&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java
Tue Jan  5 03:03:44 2010
@@ -201,11 +201,7 @@
     public void destroyObject(Object obj) throws Exception {
         if (obj instanceof PooledConnectionAndInfo) {
             PooledConnection pc = ((PooledConnectionAndInfo)obj).getPooledConnection();
-            try {
-                pc.removeConnectionEventListener(this);
-            } catch (Exception e) {
-                //ignore
-            }
+            pc.removeConnectionEventListener(this);
             pcMap.remove(pc);
             pc.close(); 
         }
@@ -304,11 +300,7 @@
             } catch (Exception e) {
                 System.err.println("CLOSING DOWN CONNECTION AS IT COULD "
                         + "NOT BE RETURNED TO THE POOL");
-                try {
-                    pc.removeConnectionEventListener(this);
-                } catch (Exception e2) {
-                    //ignore
-                }
+                pc.removeConnectionEventListener(this);
                 try {
                     destroyObject(info);
                 } catch (Exception e2) {
@@ -326,16 +318,12 @@
      */
     public void connectionErrorOccurred(ConnectionEvent event) {
         PooledConnection pc = (PooledConnection)event.getSource();
-        try {
-            if (null != event.getSQLException()) {
-                System.err.println(
-                        "CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR ("
-                        + event.getSQLException() + ")");
-            }
-            pc.removeConnectionEventListener(this);
-        } catch (Exception ignore) {
-            // ignore
+        if (null != event.getSQLException()) {
+            System.err.println(
+                    "CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR ("
+                    + event.getSQLException() + ")");
         }
+        pc.removeConnectionEventListener(this);
 
         Object info = pcMap.get(pc);
         if (info == null) {

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java?rev=895869&r1=895868&r2=895869&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
Tue Jan  5 03:03:44 2010
@@ -191,11 +191,7 @@
     public void destroyObject(Object key, Object obj) throws Exception {
         if (obj instanceof PooledConnectionAndInfo) {
             PooledConnection pc = ((PooledConnectionAndInfo)obj).getPooledConnection();
-            try {
-                pc.removeConnectionEventListener(this);
-            } catch (Exception e) {
-                //ignore
-            }
+            pc.removeConnectionEventListener(this);
             pcMap.remove(pc);
             pc.close(); 
         }
@@ -302,11 +298,7 @@
             } catch (Exception e) {
                 System.err.println("CLOSING DOWN CONNECTION AS IT COULD " +
                 "NOT BE RETURNED TO THE POOL");
-                try {
-                    pc.removeConnectionEventListener(this);
-                } catch (Exception e2) {
-                    //ignore
-                }
+                pc.removeConnectionEventListener(this);
                 try {
                     _pool.invalidateObject(info.getUserPassKey(), info);
                 } catch (Exception e3) {
@@ -324,16 +316,12 @@
      */
     public void connectionErrorOccurred(ConnectionEvent event) {
         PooledConnection pc = (PooledConnection)event.getSource();
-        try {
-            if (null != event.getSQLException()) {
-                System.err
-                    .println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" +
-                             event.getSQLException() + ")");
-            }
-            pc.removeConnectionEventListener(this);
-        } catch (Exception ignore) {
-            // ignore
+        if (null != event.getSQLException()) {
+            System.err
+                .println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" +
+                         event.getSQLException() + ")");
         }
+        pc.removeConnectionEventListener(this);
 
         PooledConnectionAndInfo info = (PooledConnectionAndInfo) pcMap.get(pc);
         if (info == null) {

Modified: commons/proper/dbcp/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/xdocs/changes.xml?rev=895869&r1=895868&r2=895869&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/xdocs/changes.xml (original)
+++ commons/proper/dbcp/trunk/xdocs/changes.xml Tue Jan  5 03:03:44 2010
@@ -49,6 +49,11 @@
      changes below since 1.2.2 applies to both the 1.3 and 1.4 release.  Other than
      the one issue related to adding JDBC 4 support (DBCP-191), all bug fixes
      or new features are included in both DBCP 1.3 and 1.4 ">
+      <action dev="sebb" type="fix" issue="DBCP-313" due-to="Sebastian Bazley">
+        Remove code that catches and ignores Exceptions when calling
+        PooledConnection.removeConnectionEventListener(ConnectionEventListener)
+        as the method does not throw any Exceptions.
+      </action>
       <action dev="sebb" type="update" issue="DBCP-314" due-to="Sebastian Bazley">
         Renamed variables with duplicate names in different scopes.
       </action>



Mime
View raw message