commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r830136 - in /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp: TestConnectionPool.java TestPoolableConnection.java
Date Tue, 27 Oct 2009 11:28:05 GMT
Author: sebb
Date: Tue Oct 27 11:28:05 2009
New Revision: 830136

URL: http://svn.apache.org/viewvc?rev=830136&view=rev
Log:
Null checks

Modified:
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPoolableConnection.java

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=830136&r1=830135&r2=830136&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Tue
Oct 27 11:28:05 2009
@@ -606,9 +606,9 @@
                     _complete = true;
                     break;
                 } finally {
-                    try { rset.close(); } catch(Exception e) { }
-                    try { stmt.close(); } catch(Exception e) { }
-                    try { 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) { }
                 }
             }
             _complete = true;

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPoolableConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPoolableConnection.java?rev=830136&r1=830135&r2=830136&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPoolableConnection.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestPoolableConnection.java
Tue Oct 27 11:28:05 2009
@@ -65,7 +65,7 @@
 
         // Now return the connection by closing it
         try {
-            c.close();
+            c.close(); // Can't be null
         } catch (SQLException e) {
             fail("Could not close connection: " + e.getMessage());
         }



Mime
View raw message