Bugfix for illegal field in interface: added extra check that instrumented jdbc impl class is not an interface

This commit is contained in:
Sander Hautvast 2019-12-19 16:16:50 +01:00
parent a6f481fc43
commit 5a2ee4e7ec

View file

@ -189,7 +189,7 @@ public class JdbcInstrumentor extends Instrumentor {
} }
boolean isJdbcPreparedStatementImpl(String resource, CtClass ctClass) throws NotFoundException { boolean isJdbcPreparedStatementImpl(String resource, CtClass ctClass) throws NotFoundException {
if (!resource.startsWith("java/sql")) { if (!ctClass.isInterface() && !resource.startsWith("java/sql")) {
return stream(ctClass.getInterfaces()) return stream(ctClass.getInterfaces())
.anyMatch(i -> i.getName().equals("java.sql.PreparedStatement")); .anyMatch(i -> i.getName().equals("java.sql.PreparedStatement"));
} }
@ -197,7 +197,7 @@ public class JdbcInstrumentor extends Instrumentor {
} }
boolean isJdbcConnectionImpl(String resource, CtClass ctClass) throws NotFoundException { boolean isJdbcConnectionImpl(String resource, CtClass ctClass) throws NotFoundException {
if (!resource.startsWith("java/sql")) { if (!ctClass.isInterface() && !resource.startsWith("java/sql")) {
return stream(ctClass.getInterfaces()) return stream(ctClass.getInterfaces())
.anyMatch(i -> i.getName().equals("java.sql.Connection")); .anyMatch(i -> i.getName().equals("java.sql.Connection"));
} }