Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HikariProxyStatement.isWrapperFor doesn't check the delegate #2237

Open
shalom938 opened this issue Sep 14, 2024 · 1 comment · May be fixed by #2243
Open

HikariProxyStatement.isWrapperFor doesn't check the delegate #2237

shalom938 opened this issue Sep 14, 2024 · 1 comment · May be fixed by #2243

Comments

@shalom938
Copy link

HikariProxyStatement.isWrapperFor delegates the call to the delegate but does not check if the delegate is or implements the required class

public boolean isWrapperFor(Class var1) throws SQLException {
        try {
            return super.delegate.isWrapperFor(var1);
        } catch (SQLException var3) {
            throw ((ProxyStatement)this).checkException(var3);
        }
    }

on the other hand unwrap works correctly

public final <T> T unwrap(Class<T> iface) throws SQLException
   {
      if (iface.isInstance(delegate)) {
         return (T) delegate;
      }
      else if (delegate != null) {
          return delegate.unwrap(iface);
      }

      throw new SQLException("Wrapped statement is not an instance of " + iface);
   }
quaff added a commit to quaff/HikariCP that referenced this issue Sep 25, 2024
@quaff quaff linked a pull request Sep 25, 2024 that will close this issue
@quaff
Copy link
Contributor

quaff commented Sep 25, 2024

Because method isWrapperFor is generated by JavassistProxyFactory base on template method body.

Fixed by GH-2243.

quaff added a commit to quaff/HikariCP that referenced this issue Sep 25, 2024
quaff added a commit to quaff/HikariCP that referenced this issue Sep 25, 2024
quaff added a commit to quaff/HikariCP that referenced this issue Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants