Fixes #716 do not scan deeper than 10 nested SQLExceptions, it's typically a trap ... a chain that never terminates.

pull/717/head
Brett Wooldridge 9 years ago
parent 0fc6ec5c8f
commit 20e6a5d923

@ -149,7 +149,7 @@ public abstract class ProxyConnection implements Connection
final SQLException checkException(SQLException sqle)
{
SQLException nse = sqle;
while (nse != null && delegate != ClosedConnection.CLOSED_CONNECTION) {
for (int depth = 0; nse != null && delegate != ClosedConnection.CLOSED_CONNECTION && depth < 10; depth++) {
final String sqlState = nse.getSQLState();
if (sqlState != null && sqlState.startsWith("08") || ERROR_STATES.contains(sqlState) || ERROR_CODES.contains(sqle.getErrorCode())) {
// broken connection
@ -159,12 +159,8 @@ public abstract class ProxyConnection implements Connection
poolEntry.evict("(connection is broken)");
delegate = ClosedConnection.CLOSED_CONNECTION;
}
else {
nse = sqle.getNextException();
if (nse == sqle) {
break;
}
}
nse = sqle.getNextException();
}
return sqle;

Loading…
Cancel
Save