Skip to content

Commit a0b10f6

Browse files
committed
add a check in LocalizationFeature to ensure requested charset is indeed selected
1 parent 4018cae commit a0b10f6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/localization/LocalizationFeature.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ public void afterRegistration(AfterRegistrationAccess access) {
237237
UserError.guarantee(defaultLocale != null, "Invalid default locale %s", Options.DefaultLocale.getValue());
238238
try {
239239
defaultCharset = Charset.forName(Options.DefaultCharset.getValue());
240+
VMError.guarantee(defaultCharset.name().equals(Options.DefaultCharset.getValue()),
241+
"Failed to locate charset " + Options.DefaultCharset.getValue() + ", instead " + defaultCharset.name() + " was provided");
240242
} catch (IllegalCharsetNameException | UnsupportedCharsetException ex) {
241243
throw UserError.abort(ex, "Invalid default charset %s", Options.DefaultCharset.getValue());
242244
}

0 commit comments

Comments
 (0)