From 00fb00bb56fe5488e608b25ee9cd7e488eb292b3 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Sun, 7 Sep 2014 19:44:16 +0900 Subject: [PATCH] Fix regression in code-generation caused by cleanup. --- .../java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java | 6 +++--- .../main/java/com/zaxxer/hikari/proxy/StatementProxy.java | 5 +++++ .../java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java | 6 +++--- .../main/java/com/zaxxer/hikari/proxy/StatementProxy.java | 5 +++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/hikaricp-java6/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java b/hikaricp-java6/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java index c3cad8f1..8f6fa0e9 100644 --- a/hikaricp-java6/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java +++ b/hikaricp-java6/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java @@ -81,15 +81,15 @@ public final class JavassistProxyFactory try { // Connection is special, it has a checkClosed() call at the beginning - String methodBody = "{ checkClosed(); try { return delegate.method($$); } catch (SQLException e) { checkException(e); throw e;} }"; + String methodBody = "{ checkClosed(); try { return delegate.method($$); } catch (SQLException e) { throw checkException(e); } }"; generateProxyClass(Connection.class, ConnectionProxy.class, methodBody); // Cast is not needed for these - methodBody = "{ try { return delegate.method($$); } catch (SQLException e) { checkException(e); throw e;} }"; + methodBody = "{ try { return delegate.method($$); } catch (SQLException e) { throw checkException(e); } }"; generateProxyClass(Statement.class, StatementProxy.class, methodBody); // For these we have to cast the delegate - methodBody = "{ try { return ((cast) delegate).method($$); } catch (SQLException e) { checkException(e); throw e;} }"; + methodBody = "{ try { return ((cast) delegate).method($$); } catch (SQLException e) { throw checkException(e); } }"; generateProxyClass(PreparedStatement.class, PreparedStatementProxy.class, methodBody); generateProxyClass(CallableStatement.class, CallableStatementProxy.class, methodBody); } diff --git a/hikaricp-java6/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java b/hikaricp-java6/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java index 8f36e465..446b7ef1 100644 --- a/hikaricp-java6/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java +++ b/hikaricp-java6/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java @@ -40,6 +40,11 @@ public abstract class StatementProxy implements Statement this.delegate = statement; } + protected final SQLException checkException(SQLException e) + { + return connection.checkException(e); + } + // ********************************************************************** // Overridden java.sql.Statement Methods // ********************************************************************** diff --git a/hikaricp/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java b/hikaricp/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java index 75d8ff47..f50751a3 100644 --- a/hikaricp/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java +++ b/hikaricp/src/main/java/com/zaxxer/hikari/proxy/JavassistProxyFactory.java @@ -81,15 +81,15 @@ public final class JavassistProxyFactory try { // Connection is special, it has a checkClosed() call at the beginning - String methodBody = "{ checkClosed(); try { return delegate.method($$); } catch (SQLException e) { checkException(e); throw e;} }"; + String methodBody = "{ checkClosed(); try { return delegate.method($$); } catch (SQLException e) { throw checkException(e); } }"; generateProxyClass(Connection.class, ConnectionProxy.class, methodBody); // Cast is not needed for these - methodBody = "{ try { return delegate.method($$); } catch (SQLException e) { checkException(e); throw e;} }"; + methodBody = "{ try { return delegate.method($$); } catch (SQLException e) { throw checkException(e); } }"; generateProxyClass(Statement.class, StatementProxy.class, methodBody); // For these we have to cast the delegate - methodBody = "{ try { return ((cast) delegate).method($$); } catch (SQLException e) { checkException(e); throw e;} }"; + methodBody = "{ try { return ((cast) delegate).method($$); } catch (SQLException e) { throw checkException(e); } }"; generateProxyClass(PreparedStatement.class, PreparedStatementProxy.class, methodBody); generateProxyClass(CallableStatement.class, CallableStatementProxy.class, methodBody); } diff --git a/hikaricp/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java b/hikaricp/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java index 8f36e465..446b7ef1 100644 --- a/hikaricp/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java +++ b/hikaricp/src/main/java/com/zaxxer/hikari/proxy/StatementProxy.java @@ -40,6 +40,11 @@ public abstract class StatementProxy implements Statement this.delegate = statement; } + protected final SQLException checkException(SQLException e) + { + return connection.checkException(e); + } + // ********************************************************************** // Overridden java.sql.Statement Methods // **********************************************************************