=== modified file 'CHANGES' --- CHANGES 2009-11-30 20:11:31 +0000 +++ CHANGES 2009-12-10 23:00:24 +0000 @@ -3,6 +3,8 @@ mm-dd-yy - Version 5.1.11 (not yet released) + - Fix for BUG#49607 - Provide Connection context in ExceptionInterceptor. + - Fix for BUG#48605 - Ping leaves closed connections in liveConnections, causing subsequent Exceptions when that connection is used. === modified file 'src/com/mysql/jdbc/ConnectionImpl.java' --- src/com/mysql/jdbc/ConnectionImpl.java 2009-11-30 20:11:31 +0000 +++ src/com/mysql/jdbc/ConnectionImpl.java 2009-12-10 22:59:25 +0000 @@ -87,12 +87,12 @@ interceptors = Util.loadExtensions(ConnectionImpl.this, props, interceptorClasses, "Connection.BadExceptionInterceptor", this); } - public SQLException interceptException(SQLException sqlEx) { + public SQLException interceptException(SQLException sqlEx, Connection conn) { if (interceptors != null) { Iterator iter = interceptors.iterator(); while (iter.hasNext()) { - sqlEx = ((ExceptionInterceptor)iter.next()).interceptException(sqlEx); + sqlEx = ((ExceptionInterceptor)iter.next()).interceptException(sqlEx, ConnectionImpl.this); } } === modified file 'src/com/mysql/jdbc/ExceptionInterceptor.java' --- src/com/mysql/jdbc/ExceptionInterceptor.java 2008-11-11 06:19:59 +0000 +++ src/com/mysql/jdbc/ExceptionInterceptor.java 2009-11-25 23:03:36 +0000 @@ -25,5 +25,5 @@ import java.sql.SQLException; public interface ExceptionInterceptor extends Extension { - public abstract SQLException interceptException(SQLException sqlEx); + public abstract SQLException interceptException(SQLException sqlEx, Connection conn); } === modified file 'src/com/mysql/jdbc/MysqlIO.java' --- src/com/mysql/jdbc/MysqlIO.java 2009-11-18 19:35:06 +0000 +++ src/com/mysql/jdbc/MysqlIO.java 2009-11-25 23:56:49 +0000 @@ -3560,7 +3560,7 @@ if (xOpen != null && xOpen.startsWith("22")) { throw new MysqlDataTruncation(errorBuf.toString(), 0, true, false, 0, 0, errno); } else { - throw SQLError.createSQLException(errorBuf.toString(), xOpen, errno, getExceptionInterceptor()); + throw SQLError.createSQLException(errorBuf.toString(), xOpen, errno, false, getExceptionInterceptor(), this.connection); } } @@ -3573,7 +3573,7 @@ SQLError.SQL_STATE_COLUMN_NOT_FOUND) + ", " //$NON-NLS-1$ +serverErrorMessage, SQLError.SQL_STATE_COLUMN_NOT_FOUND, - -1, getExceptionInterceptor()); + -1, false, getExceptionInterceptor(), this.connection); } StringBuffer errorBuf = new StringBuffer(Messages.getString( @@ -3583,7 +3583,7 @@ throw SQLError.createSQLException(SQLError.get( SQLError.SQL_STATE_GENERAL_ERROR) + ", " //$NON-NLS-1$ - +errorBuf.toString(), SQLError.SQL_STATE_GENERAL_ERROR, -1, getExceptionInterceptor()); + +errorBuf.toString(), SQLError.SQL_STATE_GENERAL_ERROR, -1, false, getExceptionInterceptor(), this.connection); } } === modified file 'src/com/mysql/jdbc/SQLError.java' --- src/com/mysql/jdbc/SQLError.java 2009-11-18 19:31:27 +0000 +++ src/com/mysql/jdbc/SQLError.java 2009-11-25 23:09:55 +0000 @@ -927,10 +927,13 @@ } public static SQLException createSQLException(String message, ExceptionInterceptor interceptor) { + return createSQLException(message, interceptor, null); + } + public static SQLException createSQLException(String message, ExceptionInterceptor interceptor, Connection conn) { SQLException sqlEx = new SQLException(message); if (interceptor != null) { - SQLException interceptedEx = interceptor.interceptException(sqlEx); + SQLException interceptedEx = interceptor.interceptException(sqlEx, conn); if (interceptedEx != null) { return interceptedEx; @@ -941,6 +944,10 @@ } public static SQLException createSQLException(String message, String sqlState, Throwable cause, ExceptionInterceptor interceptor) { + return createSQLException(message, sqlState, cause, interceptor, null); + } + public static SQLException createSQLException(String message, String sqlState, Throwable cause, ExceptionInterceptor interceptor, + Connection conn) { if (THROWABLE_INIT_CAUSE_METHOD == null) { if (cause != null) { message = message + " due to " + cause.toString(); @@ -959,7 +966,7 @@ } if (interceptor != null) { - SQLException interceptedEx = interceptor.interceptException(sqlEx); + SQLException interceptedEx = interceptor.interceptException(sqlEx, conn); if (interceptedEx != null) { return interceptedEx; @@ -976,6 +983,10 @@ public static SQLException createSQLException(String message, String sqlState, int vendorErrorCode, boolean isTransient, ExceptionInterceptor interceptor) { + return createSQLException(message, sqlState, vendorErrorCode, false, interceptor, null); + } + public static SQLException createSQLException(String message, + String sqlState, int vendorErrorCode, boolean isTransient, ExceptionInterceptor interceptor, Connection conn) { try { SQLException sqlEx = null; @@ -1065,7 +1076,7 @@ } if (interceptor != null) { - SQLException interceptedEx = interceptor.interceptException(sqlEx); + SQLException interceptedEx = interceptor.interceptException(sqlEx, conn); if (interceptedEx != null) { return interceptedEx; @@ -1084,7 +1095,7 @@ SQL_STATE_GENERAL_ERROR); if (interceptor != null) { - SQLException interceptedEx = interceptor.interceptException(unexpectedEx); + SQLException interceptedEx = interceptor.interceptException(unexpectedEx, conn); if (interceptedEx != null) { return interceptedEx; @@ -1124,7 +1135,7 @@ } if (interceptor != null) { - SQLException interceptedEx = interceptor.interceptException(exToReturn); + SQLException interceptedEx = interceptor.interceptException(exToReturn, conn); if (interceptedEx != null) { return interceptedEx;