Skip to content

[JDBC] Harden trustStore and tlsRootCerts handling for blank values and missing password #1500

Closed

Description

@jbonofre

Follow-up to #1496 (#1499).

Describe the bug

  1. Blank trustStore / tlsRootCerts values are treated as file paths:
    ArrowFlightConnectionConfigImpl#getTrustStorePath(), ArrowFlightConnectionConfigImpl#getTlsRootCertificatesPath(), and the corresponding ArrowFlightSqlClientHandler.Builder setters treat empty or whitespace-only strings (for example ?trustStore=&useSystemTrustStore=true or ?tlsRootCerts=&trustStore=...) as non-null paths instead of unset. Since GH-1499: [JDBC] Prefer an explicit trustStore over the system trust store #1496 gave trustStore precedence over useSystemTrustStore, a blank trustStore="" now shadows useSystemTrustStore and fails trying to open an empty path instead of falling back.
  2. Missing trustStorePassword throws an uncaught NullPointerException:
    When trustStore is configured without trustStorePassword, ClientAuthenticationUtils.getCertificateStream() throws NullPointerException via Preconditions.checkNotNull, which bypasses ArrowFlightSqlClientHandler.Builder#build()'s catch block (so it is not wrapped in SQLException) and bypasses ArrowFlightConnection#createNewClientHandler()'s allocator cleanup.
  3. Javadoc and test assertions:
    • ArrowFlightSqlClientHandler.Builder#withSystemTrustStore Javadoc does not document that it is ignored when trustStorePath or tlsRootCertificatesPath is set (matching docs/source/flight_sql_jdbc_driver.rst).
    • ConnectionTlsTest#testGetAuthenticatedEncryptedConnectionWithKeyStoreBadPassword only checks that any SQLException is thrown rather than verifying the keystore password failure cause.

Expected behavior

  • Blank trustStore and tlsRootCerts values are treated as unset (null), consistent with hostnameOverride.
  • Configuring trustStore without trustStorePassword fails cleanly with SQLException (wrapping IllegalArgumentException) and closes the connection allocator.
  • Builder Javadoc and tests accurately document and verify these behaviors.

Activity

  1. added this to the 20.0.0 milestone on Nov 18, 2026
  2. added a commit that references this issue on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions