diff --git a/src/main/java/com/alibaba/druid/pool/DruidPooledResultSet.java b/src/main/java/com/alibaba/druid/pool/DruidPooledResultSet.java index 8f64c92e55..c30895be8e 100644 --- a/src/main/java/com/alibaba/druid/pool/DruidPooledResultSet.java +++ b/src/main/java/com/alibaba/druid/pool/DruidPooledResultSet.java @@ -27,7 +27,6 @@ import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.RowId; import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLWarning; import java.sql.SQLXML; import java.sql.Statement; @@ -1763,11 +1762,21 @@ public final class DruidPooledResultSet extends PoolableWrapper implements Resul } } + @Override public T getObject(int columnIndex, Class type) throws SQLException { - return rs.getObject(columnIndex, type); + try { + return rs.getObject(columnIndex, type); + } catch (Throwable t) { + throw checkException(t); + } } + @Override public T getObject(String columnLabel, Class type) throws SQLException { - return rs.getObject(columnLabel, type); + try { + return rs.getObject(columnLabel, type); + } catch (Throwable t) { + throw checkException(t); + } } } diff --git a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java index 9dfb94d9bf..7c8f2baec2 100644 --- a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java +++ b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java @@ -29,7 +29,6 @@ import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.RowId; import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLWarning; import java.sql.SQLXML; import java.sql.Statement; @@ -1548,15 +1547,20 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro return result; } + @Override public T getObject(int columnIndex, Class type) throws SQLException { FilterChainImpl chain = createChain(); - Object value = chain.resultSet_getObject(this, columnIndex, type); + T value = chain.resultSet_getObject(this, columnIndex, type); recycleFilterChain(chain); - return (T) value; + return value; } + @Override public T getObject(String columnLabel, Class type) throws SQLException { - throw new SQLFeatureNotSupportedException(); + FilterChainImpl chain = createChain(); + T value = chain.resultSet_getObject(this, columnLabel, type); + recycleFilterChain(chain); + return value; } public int getCloseCount() { @@ -1604,6 +1608,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro } @SuppressWarnings("unchecked") + @Override public T unwrap(Class iface) throws SQLException { if (iface == ResultSetProxy.class || iface == ResultSetProxyImpl.class) { return (T) this; @@ -1612,6 +1617,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro return super.unwrap(iface); } + @Override public boolean isWrapperFor(Class iface) throws SQLException { if (iface == ResultSetProxy.class || iface == ResultSetProxyImpl.class) { return true;