You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/11/02 16:55:40 UTC

svn commit: r1636146 - /manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java

Author: kwright
Date: Sun Nov  2 15:55:39 2014
New Revision: 1636146

URL: http://svn.apache.org/r1636146
Log:
Handle new sql error which Postgresql apparently added recently.  Part of CONNECTORS-1090.

Modified:
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1636146&r1=1636145&r2=1636146&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java Sun Nov  2 15:55:39 2014
@@ -611,7 +611,10 @@ public class DBInterfacePostgreSQL exten
       return theException;
     Throwable e = theException.getCause();
     if (!(e instanceof java.sql.SQLException))
+    {
+      //e.printStackTrace();
       return theException;
+    }
     if (Logging.db.isDebugEnabled())
       Logging.db.debug("Exception "+theException.getMessage()+" is possibly a transaction abort signal");
     java.sql.SQLException sqlException = (java.sql.SQLException)e;
@@ -628,8 +631,14 @@ public class DBInterfacePostgreSQL exten
     // one could make.)
     if (sqlState != null && sqlState.equals("23505"))
       return new ManifoldCFException(message,e,ManifoldCFException.DATABASE_TRANSACTION_ABORT);
+    // New Postgresql behavior (9.3): sometimes we don't get an exception thrown, but the transaction is dead nonetheless.
+    if (sqlState != null && sqlState.equals("25P02"))
+      return new ManifoldCFException(message,e,ManifoldCFException.DATABASE_TRANSACTION_ABORT);
+      
     if (Logging.db.isDebugEnabled())
       Logging.db.debug("Exception "+theException.getMessage()+" is NOT a transaction abort signal");
+    //e.printStackTrace();
+    //System.err.println("sqlstate = "+sqlState);
     return theException;
   }