jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r605515 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: fs/db/ journal/ persistence/bundle/util/ persistence/db/
Date Wed, 19 Dec 2007 11:42:16 GMT
Author: jukka
Date: Wed Dec 19 03:42:04 2007
New Revision: 605515

URL: http://svn.apache.org/viewvc?rev=605515&view=rev
Log:
JCR-1013: Connection.setAutoCommit(...) fails if connection
          is managed for JNDIDatabasePersistenceManager
    - Added getAutoCommit() guards to all setAutoCommit()
      calls that might be made on a managed connection

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java?rev=605515&r1=605514&r2=605515&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
Wed Dec 19 03:42:04 2007
@@ -954,7 +954,10 @@
      */
     protected void initConnection() throws Exception {
         con = getConnection();
-        con.setAutoCommit(true);
+        // JCR-1013: Setter may fail unnecessarily on a managed connection
+        if (!con.getAutoCommit()) {
+            con.setAutoCommit(true);
+        }
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java?rev=605515&r1=605514&r2=605515&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
Wed Dec 19 03:42:04 2007
@@ -200,7 +200,7 @@
 
         try {
             connection = getConnection();
-            connection.setAutoCommit(true);
+            setAutoCommit(connection, true);
             checkSchema();
             buildSQLStatements();
             prepareStatements();
@@ -451,7 +451,10 @@
     private static void setAutoCommit(Connection connection, boolean autoCommit) {
         if (connection != null) {
             try {
-                connection.setAutoCommit(autoCommit);
+                // JCR-1013: Setter may fail on a managed connection
+                if (connection.getAutoCommit() != autoCommit) {
+                    connection.setAutoCommit(autoCommit);
+                }
             } catch (SQLException e) {
                 String msg = "Unable to set autocommit flag to " + autoCommit;
                 log.warn(msg, e);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java?rev=605515&r1=605514&r2=605515&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionRecoveryManager.java
Wed Dec 19 03:42:04 2007
@@ -330,7 +330,10 @@
             log.warn("Could not connect; driver: " + driver + " url: " + url + " user: "
+ user + " error: " + e.toString(), e);
             throw e;
         }
-        connection.setAutoCommit(true);
+        // JCR-1013: Setter may fail unnecessarily on a managed connection
+        if (!connection.getAutoCommit()) {
+            connection.setAutoCommit(true);
+        }
         try {
             DatabaseMetaData meta = connection.getMetaData();
             log.info("Database: " + meta.getDatabaseProductName() + " / " + meta.getDatabaseProductVersion());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java?rev=605515&r1=605514&r2=605515&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
Wed Dec 19 03:42:04 2007
@@ -742,7 +742,10 @@
      */
     protected void initConnection() throws Exception {
         con = getConnection();
-        con.setAutoCommit(false);
+        // JCR-1013: Setter may fail unnecessarily on a managed connection
+        if (con.getAutoCommit()) {
+            con.setAutoCommit(false);
+        }
     }
 
     /**



Mime
View raw message