jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r736286 - /jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
Date Wed, 21 Jan 2009 11:29:45 GMT
Author: thomasm
Date: Wed Jan 21 03:29:43 2009
New Revision: 736286

URL: http://svn.apache.org/viewvc?rev=736286&view=rev
Log:
JCR-1918 DbDataStore keeps ResultSets open

Modified:
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java?rev=736286&r1=736285&r2=736286&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
Wed Jan 21 03:29:43 2009
@@ -291,6 +291,7 @@
                     PreparedStatement prep = conn.executeStmt(selectMetaSQL, new Object[]{tempId});
                     rs = prep.getResultSet();
                     if (rs.next()) {
+                        conn.closeSilently(rs);
                         // re-try in the very, very unlikely event that the row already exists
                         continue;
                     }
@@ -298,6 +299,8 @@
                     break;
                 } catch (Exception e) {
                     throw convert("Can not insert new record", e);
+                } finally {
+                    conn.closeSilently(rs);
                 }
             }
             if (id == null) {
@@ -653,11 +656,12 @@
      */    
     public InputStream getInputStream(DataIdentifier identifier) throws DataStoreException
{
         ConnectionRecoveryManager conn = getConnection();
+        ResultSet rs = null;
         try {
             String id = identifier.toString();
             // SELECT ID, DATA FROM DATASTORE WHERE ID = ?
             PreparedStatement prep = conn.executeStmt(selectDataSQL, new Object[]{id});
-            ResultSet rs = prep.getResultSet();
+            rs = prep.getResultSet();
             if (!rs.next()) {
                 throw new DataStoreException("Record not found: " + identifier);
             }
@@ -670,6 +674,9 @@
         } catch (Exception e) {
             throw convert("Can not read identifier " + identifier, e);
         } finally {
+            if (copyWhenReading) {
+                conn.closeSilently(rs);
+            }
             putBack(conn);
         }
     }



Mime
View raw message