Skip to content

Split LibsqlUrlParser.parse into named steps #213

Closed

Description

@magnusp

Goal

Split LibsqlUrlParser.parse into named steps. One 98-line method strips the prefix, builds the URI, resolves credentials, overrides TLS, validates the encoding, resolves timeouts, and rebuilds the endpoint. The precedence rules are invisible.

Depends on

#196. The bug fix lands first so this pass does not mix a behavior change into a move.

Pin

LibsqlUrlParserTest covers namespace paths, trailing slashes, ws and wss from both prefixes, TLS upgrade, encoding aliases and case, and protobuf rejection on HTTP. #195 adds the jdbc:sqlite:http:// and timeout cases.

Scope

  • Extract normalizeUri, resolveAuthToken, resolveScheme, resolveEncoding, resolveDuration, and buildEndpoint.
  • Leave parse as an orchestrator of at most 30 lines.
  • Optionally move client construction out of LibsqlDriver.connect into a factory.

Preserve

  • Query parameters beat Properties. jwt is an alias for authToken. password is the last resort.
  • tls and ssl only upgrade. The upgrade happens before the encoding check, so ws with TLS and protobuf stays legal.
  • Unknown encodings fail with SQLException, not IllegalArgumentException.
  • A null URI path is empty, and the port is only kept when positive.

Acceptance

  • parse is an orchestrator and each step is a named method with one concern.
  • LibsqlUrlParserTest is green with no assertion edited.
  • ./mvnw -pl libsql-jdbc -am test green.
  • ./mvnw spotless:check green.
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

    P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions