mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for refactor
This commit is contained in:
@@ -35,11 +35,7 @@ public class ResultSetMetaDataBase implements ResultSetMetaData {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
if (iface == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (iface.isAssignableFrom(ResultSetMetaDataBase.class)) {
|
||||
if (isWrapperFor(iface)) {
|
||||
return (T) this;
|
||||
}
|
||||
return null;
|
||||
@@ -50,8 +46,12 @@ public class ResultSetMetaDataBase implements ResultSetMetaData {
|
||||
if (iface == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iface.isAssignableFrom(this.getClass())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ResultSetMetaDataBase.class.isAssignableFrom(iface);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.sql.SQLWarning;
|
||||
import java.sql.Statement;
|
||||
|
||||
import com.alibaba.druid.mock.MockConnectionClosedException;
|
||||
|
||||
public abstract class StatementBase implements Statement {
|
||||
|
||||
private Connection connection;
|
||||
@@ -41,8 +43,14 @@ public abstract class StatementBase implements Statement {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
protected void checkOpen() throws SQLException {
|
||||
|
||||
protected void checkOpen() throws SQLException, MockConnectionClosedException {
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
if (this.connection != null && this.connection.isClosed()) {
|
||||
throw new MockConnectionClosedException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,11 +206,7 @@ public abstract class StatementBase implements Statement {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
if (iface == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (iface.isInstance(this)) {
|
||||
if (isWrapperFor(iface)) {
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -215,7 +219,7 @@ public abstract class StatementBase implements Statement {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iface.isInstance(this)) {
|
||||
if (iface == this.getClass() || iface.isInstance(this)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user