Merge pull request #559 from DataDog/mar-kolya/add-lost-jdbc-statement-logging

Catch `AbstractMethodError` when trying to unwrap jdbc connection
This commit is contained in:
Nikolay Martynov 2018-11-01 11:50:44 -04:00 committed by GitHub
commit 13a8add2e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) {