From: Jim Procter Date: Thu, 17 Feb 2022 10:36:26 +0000 (+0000) Subject: JAL-3691 patch toUpper/toLower to use Locale.ROOT for 2.11.2 src X-Git-Tag: Release_2_11_2_1~43^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e42524a147f92c836a0a336dde394394976216d2;p=jalview.git JAL-3691 patch toUpper/toLower to use Locale.ROOT for 2.11.2 src --- diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java index 6b5e36c..ad5e350 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimUtils.java @@ -36,6 +36,7 @@ import java.awt.Color; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import org.slf4j.Logger; @@ -327,11 +328,11 @@ public abstract class ChimUtils String resType = ""; if (split.length == 2) { - resType = split[0].trim().toUpperCase(); + resType = split[0].trim().toUpperCase(Locale.ROOT); } else if (split.length == 3) { - resType = split[1].trim().toUpperCase(); + resType = split[1].trim().toUpperCase(Locale.ROOT); } if (resType.equalsIgnoreCase("HOH") || resType.equalsIgnoreCase("WAT")) { diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java index 0a248cf..46ed164 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/StructureManager.java @@ -39,6 +39,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -978,16 +979,16 @@ public class StructureManager if (os.startsWith("Linux")) { // ChimeraX .deb and .rpm packages put symbolic link from /usr/bin/chimerax - pathList.add(String.format("/usr/bin/%s", chimeraExe.toLowerCase())); + pathList.add(String.format("/usr/bin/%s", chimeraExe.toLowerCase(Locale.ROOT))); pathList.add(String.format("/usr/bin/%s", chimeraExe)); pathList.add( - String.format("/usr/local/bin/%s", chimeraExe.toLowerCase())); + String.format("/usr/local/bin/%s", chimeraExe.toLowerCase(Locale.ROOT))); pathList.add(String.format("/usr/local/bin/%s", chimeraExe)); // these paths also used by .deb and .rpm pathList.add(String.format("/usr/lib/ucsf-%s/bin/%s", - chimera.toLowerCase(), chimeraExe)); + chimera.toLowerCase(Locale.ROOT), chimeraExe)); pathList.add(String.format("/usr/libexec/UCSF-%s/bin/%s", chimera, chimeraExe)); @@ -995,15 +996,15 @@ public class StructureManager // user home paths pathList.add(String.format("%s/bin/%s", - System.getProperty("user.home"), chimeraExe.toLowerCase())); + System.getProperty("user.home"), chimeraExe.toLowerCase(Locale.ROOT))); pathList.add(String.format("%s/bin/%s", System.getProperty("user.home"), chimeraExe)); pathList.add(String.format("%s/opt/bin/%s", - System.getProperty("user.home"), chimeraExe.toLowerCase())); + System.getProperty("user.home"), chimeraExe.toLowerCase(Locale.ROOT))); pathList.add(String.format("%s/opt/bin/%s", System.getProperty("user.home"), chimeraExe)); pathList.add(String.format("%s/local/bin/%s", - System.getProperty("user.home"), chimeraExe.toLowerCase())); + System.getProperty("user.home"), chimeraExe.toLowerCase(Locale.ROOT))); pathList.add(String.format("%s/local/bin/%s", System.getProperty("user.home"), chimeraExe)); } diff --git a/src/jalview/bin/MemorySetting.java b/src/jalview/bin/MemorySetting.java index 56713b0..bb545cb 100644 --- a/src/jalview/bin/MemorySetting.java +++ b/src/jalview/bin/MemorySetting.java @@ -22,6 +22,8 @@ */ package jalview.bin; +import java.util.Locale; + /** * Methods to decide on appropriate memory setting for Jalview based on two * optionally provided values: jvmmempc - the maximum percentage of total @@ -57,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/src/jalview/util/StringUtils.java b/src/jalview/util/StringUtils.java index 273f6ec..ff1c944 100644 --- a/src/jalview/util/StringUtils.java +++ b/src/jalview/util/StringUtils.java @@ -574,9 +574,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; diff --git a/src/mc_view/PDBChain.java b/src/mc_view/PDBChain.java index 425bc18..97514e9 100755 --- a/src/mc_view/PDBChain.java +++ b/src/mc_view/PDBChain.java @@ -35,6 +35,7 @@ import jalview.util.Comparison; import java.awt.Color; import java.util.List; +import java.util.Locale; import java.util.Vector; public class PDBChain @@ -83,7 +84,7 @@ public class PDBChain public PDBChain(String thePdbid, String theId, String tempFactorColumnName) { - this.pdbid = thePdbid == null ? thePdbid : thePdbid.toLowerCase(); + this.pdbid = thePdbid == null ? thePdbid : thePdbid.toLowerCase(Locale.ROOT); this.id = theId; if (tempFactorColumnName!=null && tempFactorColumnName.length()>0) { diff --git a/src/org/json/simple/JSONValue.java b/src/org/json/simple/JSONValue.java index d6b2185..eb11cb2 100644 --- a/src/org/json/simple/JSONValue.java +++ b/src/org/json/simple/JSONValue.java @@ -10,6 +10,7 @@ import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.util.Collection; +import java.util.Locale; // import java.util.List; import java.util.Map; @@ -306,7 +307,7 @@ public class JSONValue { for(int k=0;k<4-ss.length();k++){ sb.append('0'); } - sb.append(ss.toUpperCase()); + sb.append(ss.toUpperCase(Locale.ROOT)); } else{ sb.append(ch); diff --git a/src/org/stackoverflowusers/file/WindowsShortcut.java b/src/org/stackoverflowusers/file/WindowsShortcut.java index 671e002..60c814b 100644 --- a/src/org/stackoverflowusers/file/WindowsShortcut.java +++ b/src/org/stackoverflowusers/file/WindowsShortcut.java @@ -6,6 +6,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.text.ParseException; +import java.util.Locale; /** * Represents a Windows shortcut (typically visible to Java only as a '.lnk' file). @@ -46,7 +47,7 @@ public class WindowsShortcut boolean isPotentiallyValid = false; try { isPotentiallyValid = file.isFile() - && file.getName().toLowerCase().endsWith(".lnk") + && file.getName().toLowerCase(Locale.ROOT).endsWith(".lnk") && fis.available() >= minimum_length && isMagicPresent(getBytes(fis, 32)); } finally {