From: Jim Procter Date: Thu, 17 Feb 2022 10:55:18 +0000 (+0000) Subject: JAL-3691 patch toUpper/toLower to use Locale.ROOT for 2.11.2 getdown - needs rebuild... X-Git-Tag: Release_2_11_2_1~43^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d74ee697c7ac0a0ffca7854f787821a726839e4b;p=jalview.git JAL-3691 patch toUpper/toLower to use Locale.ROOT for 2.11.2 getdown - needs rebuild / redacting --- diff --git a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java index 9deb5bc..8048728 100644 --- a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java +++ b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java @@ -1248,7 +1248,7 @@ public class Application if (j > -1) { ext = filename.substring(j+1); } - if (ext != null && LOCATOR_FILE_EXTENSION.equals(ext.toLowerCase())) { + if (ext != null && LOCATOR_FILE_EXTENSION.equals(ext.toLowerCase(Locale.ROOT))) { // this file extension should have been dealt with in Getdown class } else { _appargs.add(0, "-open"); @@ -1997,7 +1997,7 @@ public class Application String locatorFilename = filenames.length >= 1 ? filenames[0] : null; if ( !StringUtil.isBlank(locatorFilename) - && locatorFilename.toLowerCase().endsWith("."+Application.LOCATOR_FILE_EXTENSION) + && locatorFilename.toLowerCase(Locale.ROOT).endsWith("."+Application.LOCATOR_FILE_EXTENSION) ) { setLocatorFile(locatorFilename); // remove the locator filename from the filenames array @@ -2011,7 +2011,7 @@ public class Application // skip any other locator files in a multiple file list if (filename.startsWith("jalview://") || filename.startsWith("jalviews://")) { setJalviewUri(filename); - } else if (! filename.toLowerCase().endsWith("."+Application.LOCATOR_FILE_EXTENSION)) { + } else if (! filename.toLowerCase(Locale.ROOT).endsWith("."+Application.LOCATOR_FILE_EXTENSION)) { addStartupFile(filename); } } diff --git a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/EnvConfig.java b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/EnvConfig.java index 57b8d84..77997d2 100644 --- a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/EnvConfig.java +++ b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/EnvConfig.java @@ -147,7 +147,7 @@ public final class EnvConfig { String argvLocatorFilename = argv.length > 2 ? argv[2] : null; if ( !StringUtil.isBlank(argvLocatorFilename) - && argvLocatorFilename.toLowerCase().endsWith("."+Application.LOCATOR_FILE_EXTENSION) + && argvLocatorFilename.toLowerCase(Locale.ROOT).endsWith("."+Application.LOCATOR_FILE_EXTENSION) ) { notes.add(Note.info("locatorFilename in args: '"+argv[2]+"'")); Application.setLocatorFile(argvLocatorFilename); diff --git a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/LaunchUtil.java b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/LaunchUtil.java index ae493bb..31a69c3 100644 --- a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/LaunchUtil.java +++ b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/LaunchUtil.java @@ -139,7 +139,7 @@ public class LaunchUtil MessageDigest md = MessageDigest.getInstance(algo); md.update(Files.readAllBytes(Paths.get(file.getAbsolutePath()))); byte[] digest = md.digest(); - checksum = DatatypeConverter.printHexBinary(digest).toUpperCase(); + checksum = DatatypeConverter.printHexBinary(digest).toUpperCase(Locale.ROOT); } catch (Exception e) { System.out.println("Couldn't create "+algo+" digest of "+file.getPath()); } diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/HiDPISetting.java b/getdown/src/getdown/core/src/main/java/jalview/bin/HiDPISetting.java index d6d440a..75106cc 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/bin/HiDPISetting.java +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/HiDPISetting.java @@ -1,6 +1,8 @@ package jalview.bin; import java.awt.HeadlessException; +import java.util.Locale; + public class HiDPISetting { @@ -43,7 +45,7 @@ public class HiDPISetting static { String system = System.getProperty("os.name") == null ? null - : System.getProperty("os.name").toLowerCase(); + : System.getProperty("os.name").toLowerCase(Locale.ROOT); if (system != null) { isLinux = system.indexOf("linux") > -1; diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java b/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java index 55e304d..f5f0196 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java @@ -33,6 +33,7 @@ package jalview.bin; * @author bsoares * */ +import java.util.Locale; public class MemorySetting { @@ -58,10 +59,10 @@ public class MemorySetting + "_CUSTOMISED_SETTINGS"; public static final String MEMORY_JVMMEMPC = NS + "_" - + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME.toUpperCase(); + + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME.toUpperCase(Locale.ROOT); public static final String MEMORY_JVMMEMMAX = NS + "_" - + MAX_HEAPSIZE_PROPERTY_NAME.toUpperCase(); + + MAX_HEAPSIZE_PROPERTY_NAME.toUpperCase(Locale.ROOT); protected static boolean logToClassChecked = false; diff --git a/getdown/src/getdown/core/src/main/java/jalview/util/StringUtils.java b/getdown/src/getdown/core/src/main/java/jalview/util/StringUtils.java index d758395..afb9c89 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/util/StringUtils.java +++ b/getdown/src/getdown/core/src/main/java/jalview/util/StringUtils.java @@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.regex.Pattern; public class StringUtils @@ -409,9 +410,9 @@ public class StringUtils } if (s.length() <= 1) { - return s.toUpperCase(); + return s.toUpperCase(Locale.ROOT); } - return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); + return s.substring(0, 1).toUpperCase(Locale.ROOT) + s.substring(1).toLowerCase(Locale.ROOT); } /** @@ -427,7 +428,7 @@ public class StringUtils { return null; } - String tmp2up = text.toUpperCase(); + String tmp2up = text.toUpperCase(Locale.ROOT); int startTag = tmp2up.indexOf(""); if (startTag > -1) { @@ -572,9 +573,9 @@ public class StringUtils public static int firstCharPosIgnoreCase(String text, String chars) { int min = text.length() + 1; - for (char c : chars.toLowerCase().toCharArray()) + for (char c : chars.toLowerCase(Locale.ROOT).toCharArray()) { - int i = text.toLowerCase().indexOf(c); + int i = text.toLowerCase(Locale.ROOT).indexOf(c); if (0 <= i && i < min) { min = i;