Oracle JSONIndexBuilder produces locale-dependent index names

Author: Hugo-DDTCreated Sep 17, 2026Updated Sep 17, 2026

Bug

JSONIndexBuilder.getIndexName() (module langchain4j-oracle) builds Oracle index names from user-provided metadata keys using String.toUpperCase() without a Locale:

java
.map(metadataKey -> metadataKey.getKey().toUpperCase())

Under the Turkish (tr-TR) or Azerbaijani (az) locale, "city".toUpperCase() returns "CİTY" (dotted İ), so the same metadata key produces a different index name depending on the JVM's default locale.

Impact

The generated index name becomes locale-dependent: the same key yields different Oracle index names on machines with different default locales, causing schema drift, index lookup failures and DROP INDEX failures.

Fix

Use toUpperCase(Locale.ROOT).

Reproduce

java
Locale.setDefault(Locale.forLanguageTag("tr-TR"));
JSONIndexBuilder builder = Index.jsonIndexBuilder().key("city", String.class, JSONIndexBuilder.Order.ASC);
System.out.println(builder.getIndexName(table)); // vectors_METADATA_CİTY (expected vectors_METADATA_CITY)

Happy to open a PR with the one-line fix plus a unit test.