IntervalStringUtils.formatIntervalYear and formatIntervalDay build the Oracle-style INTERVAL YEAR TO MONTH / INTERVAL DAY TO SECOND strings that the JDBC interval accessor returns from getString()/getObject() with String.format("...%d...", ...) and no explicit Locale. java.util.Formatter localises %d digits with the JVM default locale, so on a JVM whose default locale uses non-ASCII digits (e.g. ar-EG, bn-BD, mr-IN) an interval renders as +٠٢١-٠٢ instead of +021-02. The value handed back to JDBC clients is then non-ASCII and any downstream code that parses it as [+-]YYY-MM / [+-]DDD HH:MM:SS.mmm breaks.
This is the same root cause as GH-1300 (C Data Interface format strings), just in the JDBC layer. Fix is to pass Locale.ROOT to the two String.format calls.
Reproduction
Locale.setDefault(Locale.forLanguageTag("ar-EG"));
IntervalStringUtils.formatIntervalYear(Period.of(21, 2, 0)); // returns "+٠٢١-٠٢", expected "+021-02"
IntervalStringUtils.formatIntervalYearandformatIntervalDaybuild the Oracle-styleINTERVAL YEAR TO MONTH/INTERVAL DAY TO SECONDstrings that the JDBC interval accessor returns fromgetString()/getObject()withString.format("...%d...", ...)and no explicitLocale.java.util.Formatterlocalises%ddigits with the JVM default locale, so on a JVM whose default locale uses non-ASCII digits (e.g.ar-EG,bn-BD,mr-IN) an interval renders as+٠٢١-٠٢instead of+021-02. The value handed back to JDBC clients is then non-ASCII and any downstream code that parses it as[+-]YYY-MM/[+-]DDD HH:MM:SS.mmmbreaks.This is the same root cause as GH-1300 (C Data Interface format strings), just in the JDBC layer. Fix is to pass
Locale.ROOTto the twoString.formatcalls.Reproduction