8301569: jmod list option and jimage list --help not interpreted correctly on turkish locale

Reviewed-by: mchung, naoto, jpai
This commit is contained in:
Glavo 2023-06-29 01:34:26 +00:00 committed by Jaikiran Pai
parent 8f5a38488c
commit 6f58ab2bb9
4 changed files with 8 additions and 7 deletions

View File

@ -180,7 +180,7 @@ class JImageTask {
String[] remaining = args;
try {
command = args[0];
options.task = Enum.valueOf(Task.class, args[0].toUpperCase(Locale.ENGLISH));
options.task = Enum.valueOf(Task.class, args[0].toUpperCase(Locale.ROOT));
remaining = args.length > 1 ? Arrays.copyOfRange(args, 1, args.length)
: new String[0];
} catch (IllegalArgumentException ex) {
@ -212,7 +212,7 @@ class JImageTask {
} else {
try {
log.println(TASK_HELPER.getMessage("main.usage." +
options.task.toString().toLowerCase()));
options.task.toString().toLowerCase(Locale.ROOT)));
} catch (MissingResourceException ex) {
throw TASK_HELPER.newBadArgs("err.not.a.task", command);
}

View File

@ -810,7 +810,7 @@ public class JlinkTask {
try (Stream<Archive.Entry> entries = modularJarArchive.entries()) {
boolean hasSignatures = entries.anyMatch((entry) -> {
String name = entry.name().toUpperCase(Locale.ENGLISH);
String name = entry.name().toUpperCase(Locale.ROOT);
return name.startsWith("META-INF/") && name.indexOf('/', 9) == -1 && (
name.endsWith(".SF") ||

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
package jdk.tools.jlink.internal.plugins;
import java.util.Locale;
import java.util.Map;
import jdk.internal.classfile.Classfile;
import jdk.internal.classfile.ClassTransform;
@ -70,7 +71,7 @@ abstract class VersionPropsPlugin extends AbstractPlugin {
* @param field The name of the java.lang.VersionProps field to be redefined
*/
protected VersionPropsPlugin(String field) {
this(field, field.toLowerCase().replace('_', '-'));
this(field, field.toLowerCase(Locale.ROOT).replace('_', '-'));
}
@Override

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1471,7 +1471,7 @@ public class JmodTask {
throw new CommandException("err.missing.mode").showUsage(true);
String verb = words.get(0);
try {
options.mode = Enum.valueOf(Mode.class, verb.toUpperCase());
options.mode = Enum.valueOf(Mode.class, verb.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new CommandException("err.invalid.mode", verb).showUsage(true);
}