Skip to content

fix(jdbc): fold transaction modes and table types with Locale.ROOT #286

Closed

Description

@magnusp

What happens

TransactionMode.from and MetadataSql call toUpperCase() without a locale. Under a Turkish default locale, "immediate" folds to "İMMEDİATE", so TransactionMode.from("immediate") throws IllegalArgumentException. MetadataSql folds TABLE_TYPE values the same way, so getTables(..., new String[] {"VIEW"}) builds a predicate that matches nothing.

The probe ran against the built classes during the independent verification of #285. The full result is in #285 (comment).

Sites

  • LibsqlConnection.java:99 uses mode.toUpperCase().
  • MetadataSql.java:36 uses types[i].toUpperCase().

Fix

Use Locale.ROOT at both sites. This is the same policy as the rest of the driver after #283.

Pins

  • A test that sets Locale.setDefault(Locale.forLanguageTag("tr")) and asserts TransactionMode.from("immediate") returns IMMEDIATE and from("exclusive") returns EXCLUSIVE.
  • A test that builds the getTables predicate under the same default and asserts the VIEW type literal is VIEW.
  • Add restrict or no action to the ForeignKeyMetadata locale pin in LocaleFoldingTest, so the FK call site is mutation-sensitive too. The current cascade and set null cases contain no Turkish-sensitive letter.

Acceptance

  • Both sites use Locale.ROOT.
  • The new tests fail under the Turkish default before the fix and pass after it.
  • ./mvnw -pl libsql-jdbc -am test is green.
  • ./mvnw spotless:check is green.
  • Public API, exception types, and messages are unchanged.

Refs #283, #282.

Activity

  1. added
    bugSomething isn't working
    javaPull requests that update java code
    P2Normal priority: edge case, feature gap, or test/process improvement
    on Oct 31, 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

    P2Normal priority: edge case, feature gap, or test/process improvementbugSomething isn't workingjavaPull requests that update java code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions