Skip to content

Commit

Permalink
Fix inconsistency between isWrapperFor and unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
quaff committed Sep 25, 2024
1 parent 80d30d3 commit 2de62fe
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/zaxxer/hikari/pool/ProxyConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import static com.zaxxer.hikari.SQLExceptionOverride.Override.DO_NOT_EVICT;

/**
* This is the proxy class for java.sql.Connection.
* This is the proxy class for {@link java.sql.Connection}.
*
* @author Brett Wooldridge
*/
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/zaxxer/hikari/pool/ProxyDatabaseMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import java.sql.ResultSet;
import java.sql.SQLException;

/**
* This is the proxy class for {@link java.sql.DatabaseMetaData}.
*
* @author Brett Wooldridge
* @author Yanming Zhou
*/
public abstract class ProxyDatabaseMetaData implements DatabaseMetaData
{
protected final ProxyConnection connection;
Expand Down Expand Up @@ -302,6 +308,13 @@ public ResultSet getPseudoColumns(String catalog, String schemaPattern, String t
return ProxyFactory.getProxyResultSet(connection, (ProxyStatement) statement, resultSet);
}

/** {@inheritDoc} */
@Override
public final boolean isWrapperFor(Class<?> iface) throws SQLException
{
return iface.isInstance(delegate) || (delegate != null && delegate.isWrapperFor(iface));
}

/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/zaxxer/hikari/pool/ProxyResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
import java.sql.Statement;

/**
* This is the proxy class for java.sql.ResultSet.
* This is the proxy class for {@link java.sql.ResultSet}.
*
* @author Brett Wooldridge
* @author Yanming Zhou
*/
public abstract class ProxyResultSet implements ResultSet
{
Expand Down Expand Up @@ -85,6 +86,13 @@ public void deleteRow() throws SQLException
delegate.deleteRow();
}

/** {@inheritDoc} */
@Override
public final boolean isWrapperFor(Class<?> iface) throws SQLException
{
return iface.isInstance(delegate) || (delegate != null && delegate.isWrapperFor(iface));
}

/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/zaxxer/hikari/pool/ProxyStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import java.sql.Statement;

/**
* This is the proxy class for java.sql.Statement.
* This is the proxy class for {@link java.sql.Statement}.
*
* @author Brett Wooldridge
* @author Yanming Zhou
*/
public abstract class ProxyStatement implements Statement
{
Expand Down Expand Up @@ -233,6 +234,13 @@ public ResultSet getGeneratedKeys() throws SQLException
return proxyResultSet;
}

/** {@inheritDoc} */
@Override
public final boolean isWrapperFor(Class<?> iface) throws SQLException
{
return iface.isInstance(delegate) || (delegate != null && delegate.isWrapperFor(iface));
}

/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
Expand Down

0 comments on commit 2de62fe

Please sign in to comment.