Skip to content

socketTimeout alone in a JDBC URL throws NumberFormatException #196

Closed

Description

@magnusp

Goal

A JDBC URL with only socketTimeout throws NumberFormatException from DriverManager. The parser enters the timeout branch but reads the missing connectTimeout parameter.

Where

LibsqlUrlParser lines 96 to 100.

if (queryParams.containsKey("connectTimeout") || queryParams.containsKey("socketTimeout")) {
    connectTimeout = Duration.ofMillis(Long.parseLong(queryParams.get("connectTimeout")));

Long.parseLong(null) throws NumberFormatException, so the caller sees an unchecked exception instead of a SQLException. LibsqlClientConfig has no socket timeout field, so the parameter has nowhere to go today.

Repro

jdbc:libsql:http://localhost:8080/dev/tenant?socketTimeout=5000 through DriverManager.getConnection fails at parse time.

Scope

  • Add the failing test first and record the red run.
  • Take socketTimeout out of the guard so the parameter is ignored like any other unknown parameter.
  • If a socket timeout is wanted, file it as a feature with a field on LibsqlClientConfig. Do not map it onto the connect timeout.

Acceptance

  • A test covers socketTimeout alone and fails before the fix.
  • After the fix it either connects or fails with SQLException, never NumberFormatException.
  • ./mvnw -pl libsql-jdbc -am test green.

Activity

  1. added
    bug
    P2
    on Oct 24, 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

    P2bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions