SQL: Don't override calendar for Thai locale

The Thai Buddhist calendar is close enough to Gregorian calendar that it doesn't trip H2 if timestamps with timezones are used. Related to elastic/x-pack-elasticsearch#3169.

Original commit: elastic/x-pack-elasticsearch@4f8f1b603d
This commit is contained in:
Igor Motov 2017-12-03 14:51:23 -05:00
parent a732d751c4
commit 7b701cbf88
1 changed files with 2 additions and 2 deletions

View File

@ -63,8 +63,8 @@ public class LocalH2 extends ExternalResource implements CheckedSupplier<Connect
@Override
@SuppressForbidden(reason = "H2 gets really confused with non Gregorian calendars")
protected void before() throws Throwable {
if ("gregory".equals(Calendar.getInstance().getCalendarType()) == false) {
logger.info("Non gregorian calendar is detected. Overriding locale.");
if ("japanese".equals(Calendar.getInstance().getCalendarType())) {
logger.info("Japanese calendar is detected. Overriding locale.");
locale = Locale.getDefault();
Locale.setDefault(locale.stripExtensions()); // removes the calendar setting
assert "gregory".equals(Calendar.getInstance().getCalendarType());