Skip to content

Commit

Permalink
Verify and enforce JVM locale
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Mar 25, 2024
1 parent a0dd9e3 commit 6026f35
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ final class TrinoSystemRequirements
{
private static final int MIN_FILE_DESCRIPTORS = 4096;
private static final int RECOMMENDED_FILE_DESCRIPTORS = 8192;
private static final Locale EN_US = Locale.of("en", "US");

private TrinoSystemRequirements() {}

Expand All @@ -52,6 +53,7 @@ public static void verifyJvmRequirements()
verifyFileDescriptor();
verifySlice();
verifyUtf8();
verifyLocale();
}

private static void verify64BitJvm()
Expand Down Expand Up @@ -162,6 +164,14 @@ private static void verifyUtf8()
}
}

private static void verifyLocale()
{
Locale defaultLocale = Locale.getDefault();
if (!defaultLocale.equals(EN_US)) {
failRequirement("Trino requires that the default locale is ENGLISH (found %s). This can be set with the JVM command line option -Duser.language=en -Duser.region=US", defaultLocale);
}
}

/**
* Perform a sanity check to make sure that the year is reasonably current, to guard against
* issues in third party libraries.
Expand Down

0 comments on commit 6026f35

Please sign in to comment.