Author: kwright
Date: Wed Nov 28 08:40:08 2012
New Revision: 1414575
URL: http://svn.apache.org/viewvc?rev=1414575&view=rev
Log:
Fix for CONNECTORS-571. Also modified error output for SQLException errors to
include SQLState if available.
Modified:
manifoldcf/trunk/CHANGES.txt
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
Modified: manifoldcf/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1414575&r1=1414574&r2=1414575&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Wed Nov 28 08:40:08 2012
@@ -3,6 +3,9 @@ $Id$
======================= 1.1-dev =====================
+CONNECTORS-571: MySQL timeout was not being handled properly.
+(Shigeki Kobayashi, Karl Wright)
+
CONNECTORS-569: Add User-Agent header for Wiki connector.
Newer versions of Wiki need this.
(Karl Wright)
Modified:
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java?rev=1414575&r1=1414574&r2=1414575&view=diff
==============================================================================
---
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
(original)
+++
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
Wed Nov 28 08:40:08 2012
@@ -112,6 +112,12 @@ public class DBInterfaceMySQL extends Da
//new Exception(message).printStackTrace();
return new
ManifoldCFException(message,e,ManifoldCFException.DATABASE_TRANSACTION_ABORT);
}
+ // Transaction timeout
+ if (sqlState != null && sqlState.equals("HY000"))
+ {
+ //new Exception(message).printStackTrace();
+ return new
ManifoldCFException(message,e,ManifoldCFException.DATABASE_TRANSACTION_ABORT);
+ }
// Note well: We also have to treat 'duplicate key' as a transaction
abort, since this is what you get when two threads attempt to
// insert the same row. (Everything only works, then, as long as there is
a unique constraint corresponding to every bad insert that
// one could make.)
Modified:
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java?rev=1414575&r1=1414574&r2=1414575&view=diff
==============================================================================
---
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
(original)
+++
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
Wed Nov 28 08:40:08 2012
@@ -853,7 +853,7 @@ public abstract class Database
{
// There are a lot of different sorts of error that can be embedded
here. Unfortunately, it's database dependent how
// to interpret the error. So toss a generic error, and let the
caller figure out if it needs to treat it differently.
- throw new ManifoldCFException("Exception doing query:
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
+ throw new ManifoldCFException("SQLException doing
query"+((e.getSQLState() != null)?" ("+e.getSQLState()+")":"")+":
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
}
}
finally
@@ -962,7 +962,7 @@ public abstract class Database
}
catch (java.sql.SQLException e)
{
- throw new ManifoldCFException("Resultset error:
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
+ throw new ManifoldCFException("SQLException getting
resultset"+((e.getSQLState() != null)?" ("+e.getSQLState()+")":"")+":
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
}
}
catch (Throwable e)
@@ -1101,9 +1101,9 @@ public abstract class Database
{
return rs.getBlob(col);
}
- catch (java.sql.SQLException sqle)
+ catch (java.sql.SQLException e)
{
- throw new ManifoldCFException("Error in
getBlob",sqle,ManifoldCFException.DATABASE_CONNECTION_ERROR);
+ throw new ManifoldCFException("SQLException in
getBlob"+((e.getSQLState() != null)?" ("+e.getSQLState()+")":"")+":
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
}
catch (Exception sqle)
{
@@ -1119,9 +1119,9 @@ public abstract class Database
int type = rsmd.getColumnType(col);
return (type == java.sql.Types.BLOB);
}
- catch (java.sql.SQLException sqle)
+ catch (java.sql.SQLException e)
{
- throw new ManifoldCFException("Error in isBlob("+col+"):
"+sqle.getMessage(),sqle,ManifoldCFException.DATABASE_CONNECTION_ERROR);
+ throw new ManifoldCFException("SQLException doing
isBlob("+col+")"+((e.getSQLState() != null)?" ("+e.getSQLState()+")":"")+":
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
}
catch (Exception sqle)
{
@@ -1138,9 +1138,9 @@ public abstract class Database
return (type == java.sql.Types.VARBINARY ||
type == java.sql.Types.BINARY || type == java.sql.Types.LONGVARBINARY);
}
- catch (java.sql.SQLException sqle)
+ catch (java.sql.SQLException e)
{
- throw new ManifoldCFException("Error in isBinary("+col+"):
"+sqle.getMessage(),sqle,ManifoldCFException.DATABASE_CONNECTION_ERROR);
+ throw new ManifoldCFException("SQLException doing
isBinary("+col+")"+((e.getSQLState() != null)?" ("+e.getSQLState()+")":"")+":
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
}
catch (Exception sqle)
{
@@ -1314,7 +1314,7 @@ public abstract class Database
}
catch (java.sql.SQLException e)
{
- throw new ManifoldCFException("Exception in getObject():
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
+ throw new ManifoldCFException("SQLException doing
getObject()"+((e.getSQLState() != null)?" ("+e.getSQLState()+")":"")+":
"+e.getMessage(),e,ManifoldCFException.DATABASE_CONNECTION_ERROR);
}
}
catch (Throwable e)