Skip to content

Fix setCredentialsProviderClassName storing the value in the wrong field#2405

Open
vasiliy-mikhailov wants to merge 1 commit into
brettwooldridge:devfrom
vasiliy-mikhailov:fix/credentials-provider-classname
Open

Fix setCredentialsProviderClassName storing the value in the wrong field#2405
vasiliy-mikhailov wants to merge 1 commit into
brettwooldridge:devfrom
vasiliy-mikhailov:fix/credentials-provider-classname

Conversation

@vasiliy-mikhailov

Copy link
Copy Markdown

HikariConfig.setCredentialsProviderClassName(String) assigns the class name to the exceptionOverrideClassName field instead of credentialsProviderClassName:

this.credentialsProvider = createInstance(credentialsProviderClassName, HikariCredentialsProvider.class);
this.exceptionOverrideClassName = credentialsProviderClassName;

Two consequences:

  • getCredentialsProviderClassName() always returns null, because the field is never assigned.
  • The unrelated exceptionOverrideClassName (a SQLExceptionOverride class name) is silently overwritten, so HikariCP later tries to load the credentials-provider class as a SQLExceptionOverride.

This assigns the correct field, mirroring setExceptionOverrideClassName(). Includes a regression test.

setCredentialsProviderClassName() assigned the class name to
exceptionOverrideClassName instead of credentialsProviderClassName. As a
result getCredentialsProviderClassName() always returned null, and the
unrelated SQLExceptionOverride class name was silently overwritten, so
HikariCP would later try to load the credentials provider class as a
SQLExceptionOverride. Assign the correct field, mirroring
setExceptionOverrideClassName(). Adds a regression test.
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 this pull request may close these issues.

1 participant