Catch `AbstractMethodError` when trying to unwrap jdbc connection

jdts throws this exception since they just have 'stub' umplementation.
This commit is contained in:
Nikolay Martynov 2018-11-01 09:57:18 -04:00
parent 8a066de772
commit 15024915bf
2 changed files with 4 additions and 2 deletions

View File

@ -70,9 +70,10 @@ public final class PreparedStatementInstrumentation extends Instrumenter.Default
if (connection.isWrapperFor(Connection.class)) {
connection = connection.unwrap(Connection.class);
}
} catch (final Exception e) {
} catch (final Exception | AbstractMethodError e) {
// perhaps wrapping isn't supported?
// ex: org.h2.jdbc.JdbcConnection v1.3.175
// or: jdts.jdbc which always throws `AbstractMethodError` (at least up to version 1.3)
// Stick with original connection.
}
} catch (final Throwable e) {

View File

@ -71,9 +71,10 @@ public final class StatementInstrumentation extends Instrumenter.Default {
if (connection.isWrapperFor(Connection.class)) {
connection = connection.unwrap(Connection.class);
}
} catch (final Exception e) {
} catch (final Exception | AbstractMethodError e) {
// perhaps wrapping isn't supported?
// ex: org.h2.jdbc.JdbcConnection v1.3.175
// or: jdts.jdbc which always throws `AbstractMethodError` (at least up to version 1.3)
// Stick with original connection.
}
} catch (final Throwable e) {