Right now you can not test using those methods if the tracing connection or datasource was applied. The correct implementation would be
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
if (iface.isInstance(this)) {
return (T) this;
}
return delegate.unwrap(iface);
}
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return (iface.isInstance(this) || delegate.isWrapperFor(iface);
}
In the merge #104 we added the
TracingDataSourceand theTracingConnectionclasses. In those classes the implementation ofisWrapperForandunwrapis flawedhttps://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-sql/src/main/java/com/amazonaws/xray/sql/TracingConnection.java#L309-L317
https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-sql/src/main/java/com/amazonaws/xray/sql/TracingDataSource.java#L48-L56
Right now you can not test using those methods if the tracing connection or datasource was applied. The correct implementation would be