jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: r1390911 - in /jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: persistence/pool/BundleDbPersistenceManager.java util/db/ConnectionHelper.java
Date Thu, 27 Sep 2012 09:42:08 GMT
Author: unico
Date: Thu Sep 27 09:42:08 2012
New Revision: 1390911

URL: http://svn.apache.org/viewvc?rev=1390911&view=rev
Log:
JCR-3383 Backport: Unclosed Resources in ConnectionHelper if ResultSet is null

Modified:
    jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
    jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java

Modified: jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java?rev=1390911&r1=1390910&r2=1390911&view=diff
==============================================================================
--- jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
Thu Sep 27 09:42:08 2012
@@ -498,7 +498,7 @@ public class BundleDbPersistenceManager
             }
             failures++;
             log.error("Failed to persist ChangeLog (stacktrace on DEBUG log level), blockOnConnectionLoss
= "
-                    + blockOnConnectionLoss, lastException);
+                    + blockOnConnectionLoss + ": " + lastException);
             log.debug("Failed to persist ChangeLog", lastException);
             if (blockOnConnectionLoss || failures <= 1) { // if we're going to try again
                 try {
@@ -1033,13 +1033,15 @@ public class BundleDbPersistenceManager
             ResultSet rs =
                 conHelper.exec(bundleSelectSQL, getKey(id), false, 0);
             try {
-                if (rs.next()) {
+                if (rs != null && rs.next()) {
                     return readBundle(id, rs, 1);
                 } else {
                     return null;
                 }
             } finally {
-                rs.close();
+            	if (rs != null) {
+            		rs.close();
+            	}
             }
         } catch (SQLException e) {
             String msg = "failed to read bundle: " + id + ": " + e;

Modified: jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java?rev=1390911&r1=1390910&r2=1390911&view=diff
==============================================================================
--- jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
Thu Sep 27 09:42:08 2012
@@ -407,6 +407,7 @@ public class ConnectionHelper {
             }
             // Don't wrap null
             if (rs == null) {
+            	closeResources(con, stmt, rs);
                 return null;
             }
             if (inBatchMode()) {
@@ -559,7 +560,7 @@ public class ConnectionHelper {
                     } catch (SQLException e) {
                         lastException = e;
                     }
-                    log.error("Failed to execute SQL (stacktrace on DEBUG log level)", lastException);
+                    log.error("Failed to execute SQL (stacktrace on DEBUG log level): " +
lastException);
                     log.debug("Failed to execute SQL", lastException);
                     failures++;
                     if (blockOnConnectionLoss || failures <= RETRIES) { // if we're going
to try again



Mime
View raw message