From 9d2408483e451285fd555c3cd6e0273977acbaa7 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 22 Sep 2021 00:08:45 +0100 Subject: [PATCH] JAL-3691 automatic insertion of Locale.ROOT to toUpperCase() and toLowerCase() and added import java.util.Locale appropriately --- src/jalview/analysis/AlignSeq.java | 4 +++- src/jalview/analysis/AlignmentUtils.java | 10 ++++++---- src/jalview/analysis/AnnotationSorter.java | 4 +++- src/jalview/analysis/Conservation.java | 4 +++- src/jalview/analysis/Finder.java | 4 +++- src/jalview/analysis/GeneticCodes.java | 12 +++++++----- src/jalview/analysis/SequenceIdMatcher.java | 6 ++++-- src/jalview/bin/HiDPISetting.java | 4 +++- src/jalview/bin/Jalview.java | 10 ++++++---- src/jalview/bin/JalviewLite.java | 10 ++++++---- src/jalview/bin/Launcher.java | 4 +++- src/jalview/bin/MemorySetting.java | 4 +++- src/jalview/commands/ChangeCaseCommand.java | 6 ++++-- src/jalview/commands/EditCommand.java | 8 +++++--- src/jalview/datamodel/AlignmentAnnotation.java | 4 +++- src/jalview/datamodel/DBRefEntry.java | 10 ++++++---- src/jalview/datamodel/DBRefSource.java | 12 +++++++----- src/jalview/datamodel/MappedFeatures.java | 8 +++++--- src/jalview/datamodel/features/FeatureMatcher.java | 10 ++++++---- .../datamodel/features/FeatureMatcherSet.java | 4 +++- src/jalview/ext/ensembl/EnsemblInfo.java | 8 +++++--- src/jalview/ext/jmol/JmolParser.java | 4 +++- src/jalview/ext/rbvi/chimera/ChimeraCommands.java | 4 +++- src/jalview/fts/core/FTSRestClient.java | 6 ++++-- src/jalview/gui/AlignFrame.java | 8 +++++--- src/jalview/gui/AnnotationExporter.java | 4 +++- src/jalview/gui/AnnotationLabels.java | 6 ++++-- src/jalview/gui/AppJmol.java | 4 +++- src/jalview/gui/Desktop.java | 10 ++++++---- src/jalview/gui/FeatureSettings.java | 4 +++- src/jalview/gui/Finder.java | 4 +++- src/jalview/gui/JDatabaseTree.java | 6 ++++-- src/jalview/gui/PopupMenu.java | 6 ++++-- src/jalview/gui/StructureChooser.java | 6 ++++-- src/jalview/gui/TreePanel.java | 8 +++++--- src/jalview/gui/UserDefinedColours.java | 6 ++++-- src/jalview/gui/WebserviceInfo.java | 6 ++++-- .../PDBStructureChooserQuerySource.java | 10 ++++++---- .../StructureChooserQuerySource.java | 4 +++- .../gui/structurechooser/TDBResultAnalyser.java | 8 +++++--- .../ThreeDBStructureChooserQuerySource.java | 2 +- src/jalview/io/AppletFormatAdapter.java | 4 +++- src/jalview/io/FeaturesFile.java | 6 ++++-- src/jalview/io/FileFormats.java | 8 +++++--- src/jalview/io/FormatAdapter.java | 4 +++- src/jalview/io/IdentifyFile.java | 6 ++++-- src/jalview/io/JPredFile.java | 4 +++- src/jalview/io/JalviewFileFilter.java | 6 ++++-- src/jalview/io/JalviewFileView.java | 6 ++++-- src/jalview/io/JnetAnnotationMaker.java | 4 +++- src/jalview/io/MSFfile.java | 4 +++- src/jalview/io/NewickFile.java | 4 +++- src/jalview/io/SequenceAnnotationReport.java | 8 +++++--- src/jalview/io/StockholmFile.java | 4 +++- src/jalview/io/gff/ExonerateHelper.java | 4 +++- src/jalview/io/packed/ParsePackedSet.java | 6 ++++-- src/jalview/io/vcf/VCFLoader.java | 16 +++++++++------- src/jalview/javascript/log4j/Level.java | 4 +++- .../binding/biojson/v1/ColourSchemeMapper.java | 4 +++- src/jalview/project/Jalview2XML.java | 8 +++++--- src/jalview/schemes/ColourSchemeLoader.java | 4 +++- src/jalview/schemes/ColourSchemes.java | 10 ++++++---- src/jalview/schemes/FeatureColour.java | 16 +++++++++------- src/jalview/schemes/ResidueProperties.java | 8 +++++--- src/jalview/schemes/UserColourScheme.java | 6 ++++-- src/jalview/structure/StructureImportSettings.java | 6 ++++-- .../structures/models/AAStructureBindingModel.java | 4 +++- src/jalview/util/CaseInsensitiveString.java | 4 +++- src/jalview/util/ColorUtils.java | 4 +++- src/jalview/util/DBRefUtils.java | 10 ++++++---- src/jalview/util/MessageManager.java | 2 +- src/jalview/util/ParseHtmlBodyAndLinks.java | 6 ++++-- src/jalview/util/StringUtils.java | 8 +++++--- src/jalview/util/matcher/Matcher.java | 6 ++++-- src/jalview/ws/DBRefFetcher.java | 20 +++++++++++--------- src/jalview/ws/dbsources/EmblFlatfileSource.java | 6 ++++-- src/jalview/ws/dbsources/EmblXmlSource.java | 6 ++++-- src/jalview/ws/dbsources/TDBeacons.java | 4 +++- src/jalview/ws/dbsources/Uniprot.java | 4 +++- src/jalview/ws/dbsources/Xfam.java | 8 +++++--- src/jalview/ws/ebi/EBIFetchClient.java | 6 ++++-- src/jalview/ws/io/mime/MimeTypes.java | 4 +++- src/jalview/ws/jws1/JPredClient.java | 4 +++- src/jalview/ws/jws1/MsaWSClient.java | 4 +++- src/jalview/ws/jws2/MsaWSClient.java | 4 +++- .../ws/jws2/SequenceAnnotationWSClient.java | 4 +++- src/jalview/ws/rest/InputType.java | 4 +++- src/jalview/ws/rest/RestJobThread.java | 4 +++- src/jalview/ws/sifts/SiftsClient.java | 20 +++++++++++--------- test/jalview/analysis/AlignmentGenerator.java | 4 +++- test/jalview/analysis/RnaTest.java | 6 ++++-- test/jalview/commands/EditCommandTest.java | 12 +++++++----- test/jalview/datamodel/ResidueCountTest.java | 6 ++++-- test/jalview/datamodel/SequenceTest.java | 4 +++- test/jalview/ext/ensembl/EnsemblCdnaTest.java | 4 +++- test/jalview/ext/ensembl/EnsemblGeneTest.java | 4 +++- test/jalview/ext/paradise/TestAnnotate3D.java | 6 ++++-- test/jalview/io/FileFormatsTest.java | 6 ++++-- test/jalview/ws/gui/Jws2ParamView.java | 6 ++++-- .../ws/jabaws/DisorderAnnotExportImport.java | 4 +++- test/jalview/ws/jabaws/RNAStructExportImport.java | 4 +++- test/jalview/ws/jws2/ParameterUtilsTest.java | 6 ++++-- test/junit/extensions/PrivilegedAccessor.java | 4 +++- 103 files changed, 423 insertions(+), 221 deletions(-) diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 1b2578e..2fb6ce1 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import jalview.analysis.scoremodels.PIDModel; import jalview.analysis.scoremodels.ScoreMatrix; import jalview.analysis.scoremodels.ScoreModels; @@ -148,7 +150,7 @@ public class AlignSeq public AlignSeq(SequenceI s1, String string1, SequenceI s2, String string2, String type) { - seqInit(s1, string1.toUpperCase(), s2, string2.toUpperCase(), type); + seqInit(s1, string1.toUpperCase(Locale.ROOT), s2, string2.toUpperCase(Locale.ROOT), type); } /** diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index 0c40873..23c5d64 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import jalview.commands.RemoveGapColCommand; import jalview.datamodel.AlignedCodon; import jalview.datamodel.AlignedCodonFrame; @@ -181,9 +183,9 @@ public class AlignmentUtils // TODO use Character.toLowerCase to avoid creating String objects? char[] upstream = new String(ds .getSequence(s.getStart() - 1 - ustream_ds, s.getStart() - 1)) - .toLowerCase().toCharArray(); + .toLowerCase(Locale.ROOT).toCharArray(); char[] downstream = new String( - ds.getSequence(s_end - 1, s_end + dstream_ds)).toLowerCase() + ds.getSequence(s_end - 1, s_end + dstream_ds)).toLowerCase(Locale.ROOT) .toCharArray(); char[] coreseq = s.getSequence(); char[] nseq = new char[offset + upstream.length + downstream.length @@ -462,7 +464,7 @@ public class AlignmentUtils if (cdnaLength != mappedLength && cdnaLength > 2) { String lastCodon = String.valueOf(cdnaSeqChars, - cdnaLength - CODON_LENGTH, CODON_LENGTH).toUpperCase(); + cdnaLength - CODON_LENGTH, CODON_LENGTH).toUpperCase(Locale.ROOT); for (String stop : ResidueProperties.STOP_CODONS) { if (lastCodon.equals(stop)) @@ -479,7 +481,7 @@ public class AlignmentUtils */ int startOffset = 0; if (cdnaLength != mappedLength && cdnaLength > 2 - && String.valueOf(cdnaSeqChars, 0, CODON_LENGTH).toUpperCase() + && String.valueOf(cdnaSeqChars, 0, CODON_LENGTH).toUpperCase(Locale.ROOT) .equals(ResidueProperties.START)) { startOffset += CODON_LENGTH; diff --git a/src/jalview/analysis/AnnotationSorter.java b/src/jalview/analysis/AnnotationSorter.java index 2f556f1..c9ed570 100644 --- a/src/jalview/analysis/AnnotationSorter.java +++ b/src/jalview/analysis/AnnotationSorter.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; @@ -368,7 +370,7 @@ public class AnnotationSorter { return 1; } - return label1.toUpperCase().compareTo(label2.toUpperCase()); + return label1.toUpperCase(Locale.ROOT).compareTo(label2.toUpperCase(Locale.ROOT)); } /** diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index ff38c08..6cc9dd3 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import jalview.analysis.scoremodels.ScoreMatrix; import jalview.analysis.scoremodels.ScoreModels; import jalview.datamodel.AlignmentAnnotation; @@ -312,7 +314,7 @@ public class Conservation protected static void recordConservation(Map resultMap, String res) { - res = res.toUpperCase(); + res = res.toUpperCase(Locale.ROOT); for (Entry> property : ResidueProperties.propHash .entrySet()) { diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index d52e42a..bf86a86 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import jalview.api.AlignViewportI; import jalview.api.FinderI; import jalview.datamodel.AlignmentI; @@ -148,7 +150,7 @@ public class Finder implements FinderI idMatches = new ArrayList<>(); String searchString = matchCase ? theSearchString - : theSearchString.toUpperCase(); + : theSearchString.toUpperCase(Locale.ROOT); Regex searchPattern = new Regex(searchString); searchPattern.setIgnoreCase(!matchCase); diff --git a/src/jalview/analysis/GeneticCodes.java b/src/jalview/analysis/GeneticCodes.java index df1dd82..8d69b0b 100644 --- a/src/jalview/analysis/GeneticCodes.java +++ b/src/jalview/analysis/GeneticCodes.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import jalview.bin.Cache; import java.io.BufferedReader; @@ -198,13 +200,13 @@ public final class GeneticCodes while (line != null) { line = readLine(dataIn); - if (line != null && !"DNA".equals(line.toUpperCase())) + if (line != null && !"DNA".equals(line.toUpperCase(Locale.ROOT))) { String[] tokens = line.split("\\t"); if (tokens.length == 2) { - ambiguityCodes.put(tokens[0].toUpperCase(), - tokens[1].toUpperCase()); + ambiguityCodes.put(tokens[0].toUpperCase(Locale.ROOT), + tokens[1].toUpperCase(Locale.ROOT)); } else { @@ -341,13 +343,13 @@ public final class GeneticCodes @Override public String translateCanonical(String codon) { - return codons.get(codon.toUpperCase()); + return codons.get(codon.toUpperCase(Locale.ROOT)); } @Override public String translate(String codon) { - String upper = codon.toUpperCase(); + String upper = codon.toUpperCase(Locale.ROOT); String peptide = translateCanonical(upper); /* diff --git a/src/jalview/analysis/SequenceIdMatcher.java b/src/jalview/analysis/SequenceIdMatcher.java index a85c7f3..3ec162d 100755 --- a/src/jalview/analysis/SequenceIdMatcher.java +++ b/src/jalview/analysis/SequenceIdMatcher.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import jalview.datamodel.DBRefEntry; import jalview.datamodel.SequenceI; @@ -289,7 +291,7 @@ public class SequenceIdMatcher { if (s != null) { - id = s.toLowerCase(); + id = s.toLowerCase(Locale.ROOT); } else { @@ -319,7 +321,7 @@ public class SequenceIdMatcher { if (s instanceof String) { - return this.stringequals(((String) s).toLowerCase()); + return this.stringequals(((String) s).toLowerCase(Locale.ROOT)); } } diff --git a/src/jalview/bin/HiDPISetting.java b/src/jalview/bin/HiDPISetting.java index 38b7587..6219179 100644 --- a/src/jalview/bin/HiDPISetting.java +++ b/src/jalview/bin/HiDPISetting.java @@ -1,5 +1,7 @@ package jalview.bin; +import java.util.Locale; + import java.awt.HeadlessException; public class HiDPISetting @@ -45,7 +47,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/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 0b5fafa..fe48283 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -20,6 +20,8 @@ */ package jalview.bin; +import java.util.Locale; + import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; @@ -983,9 +985,9 @@ public class Jalview for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (info.getName() != null && nameStartsWith - ? info.getName().toLowerCase() - .startsWith(name.toLowerCase()) - : info.getName().toLowerCase().equals(name.toLowerCase())) + ? info.getName().toLowerCase(Locale.ROOT) + .startsWith(name.toLowerCase(Locale.ROOT)) + : info.getName().toLowerCase(Locale.ROOT).equals(name.toLowerCase(Locale.ROOT))) { className = info.getClassName(); break; @@ -1042,7 +1044,7 @@ public class Jalview System.setProperty("apple.laf.useScreenMenuBar", "true"); set = setQuaquaLookAndFeel(); if ((!set) || !UIManager.getLookAndFeel().getClass().toString() - .toLowerCase().contains("quaqua")) + .toLowerCase(Locale.ROOT).contains("quaqua")) { set = setVaquaLookAndFeel(); } diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index e7f2a53..871ca54 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -20,6 +20,8 @@ */ package jalview.bin; +import java.util.Locale; + import jalview.analysis.AlignmentUtils; import jalview.api.StructureSelectionManagerProvider; import jalview.appletgui.AlignFrame; @@ -208,7 +210,7 @@ public class JalviewLite extends Applet final int pos = apos; // use vamsas listener to broadcast to all listeners in scope if (alignedPosition != null && (alignedPosition.trim().length() == 0 - || alignedPosition.toLowerCase().indexOf("false") > -1)) + || alignedPosition.toLowerCase(Locale.ROOT).indexOf("false") > -1)) { java.awt.EventQueue.invokeLater(new Runnable() { @@ -412,7 +414,7 @@ public class JalviewLite extends Applet r--; } catch (NumberFormatException ex) { - if (cl.toLowerCase().equals("sequence")) + if (cl.toLowerCase(Locale.ROOT).equals("sequence")) { // we are in the dataset sequence's coordinate frame. inseqpos = true; @@ -1440,7 +1442,7 @@ public class JalviewLite extends Applet String externalsviewer = getParameter("externalstructureviewer"); if (externalsviewer != null) { - useXtrnalSviewer = externalsviewer.trim().toLowerCase().equals(TRUE); + useXtrnalSviewer = externalsviewer.trim().toLowerCase(Locale.ROOT).equals(TRUE); } /** * if true disable the check for jmol @@ -2691,7 +2693,7 @@ public class JalviewLite extends Applet final String groups, boolean state) { final boolean st = state;// !(state==null || state.equals("") || - // state.toLowerCase().equals("false")); + // state.toLowerCase(Locale.ROOT).equals("false")); java.awt.EventQueue.invokeLater(new Runnable() { @Override diff --git a/src/jalview/bin/Launcher.java b/src/jalview/bin/Launcher.java index b8d31c2..e13f2dd 100644 --- a/src/jalview/bin/Launcher.java +++ b/src/jalview/bin/Launcher.java @@ -20,6 +20,8 @@ */ package jalview.bin; +import java.util.Locale; + import java.io.File; import java.io.IOException; import java.lang.management.ManagementFactory; @@ -190,7 +192,7 @@ public class Launcher process.waitFor(); } catch (IOException e) { - if (e.getMessage().toLowerCase().contains("memory")) + if (e.getMessage().toLowerCase(Locale.ROOT).contains("memory")) { System.out.println("Caught a memory exception: " + e.getMessage()); // Probably the "Cannot allocate memory" error, try without the memory diff --git a/src/jalview/bin/MemorySetting.java b/src/jalview/bin/MemorySetting.java index 5d7f14c..52f0c9e 100644 --- a/src/jalview/bin/MemorySetting.java +++ b/src/jalview/bin/MemorySetting.java @@ -31,6 +31,8 @@ package jalview.bin; * @author bsoares * */ +import java.util.Locale; + public class MemorySetting { public static final String MAX_HEAPSIZE_PERCENT_PROPERTY_NAME = "jvmmempc"; @@ -101,7 +103,7 @@ public class MemorySetting if (jvmmemmax != null && jvmmemmax.length() > 0) { long multiplier = 1; - switch (jvmmemmax.toLowerCase().substring(jvmmemmax.length() - 1)) + switch (jvmmemmax.toLowerCase(Locale.ROOT).substring(jvmmemmax.length() - 1)) { case "t": multiplier = 1099511627776L; // 2^40 diff --git a/src/jalview/commands/ChangeCaseCommand.java b/src/jalview/commands/ChangeCaseCommand.java index 7f7142f1..2d61705 100644 --- a/src/jalview/commands/ChangeCaseCommand.java +++ b/src/jalview/commands/ChangeCaseCommand.java @@ -20,6 +20,8 @@ */ package jalview.commands; +import java.util.Locale; + import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; @@ -101,13 +103,13 @@ public class ChangeCaseCommand implements CommandI if ((caseChange == TO_UPPER && doCommand) || (caseChange == TO_LOWER && !doCommand)) { - newSeq.append(sequence.substring(start, end).toUpperCase()); + newSeq.append(sequence.substring(start, end).toUpperCase(Locale.ROOT)); } else if ((caseChange == TO_LOWER && doCommand) || (caseChange == TO_UPPER && !doCommand)) { - newSeq.append(sequence.substring(start, end).toLowerCase()); + newSeq.append(sequence.substring(start, end).toLowerCase(Locale.ROOT)); } else diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index d0790c8..30595bc 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -20,6 +20,8 @@ */ package jalview.commands; +import java.util.Locale; + import jalview.analysis.AlignSeq; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; @@ -789,7 +791,7 @@ public class EditCommand implements CommandI String nogapold = AlignSeq.extractGaps(Comparison.GapChars, new String(command.string[i])); - if (!nogaprep.toLowerCase().equals(nogapold.toLowerCase())) + if (!nogaprep.toLowerCase(Locale.ROOT).equals(nogapold.toLowerCase(Locale.ROOT))) { // we may already have dataset and limits stashed... if (newDSWasNeeded || newStartEndWasNeeded) @@ -838,7 +840,7 @@ public class EditCommand implements CommandI // old ds and edited ds are different, so // create the new dataset sequence SequenceI newds = new Sequence(oldds); - newds.setSequence(fullseq.toUpperCase()); + newds.setSequence(fullseq.toUpperCase(Locale.ROOT)); if (command.oldds == null) { @@ -891,7 +893,7 @@ public class EditCommand implements CommandI // new // start/end String nogapalseq = AlignSeq.extractGaps(Comparison.GapChars, - command.seqs[i].getSequenceAsString().toUpperCase()); + command.seqs[i].getSequenceAsString().toUpperCase(Locale.ROOT)); int newStart = command.seqs[i].getDatasetSequence() .getSequenceAsString().indexOf(nogapalseq); if (newStart == -1) diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 2ee4503..d41cdd4 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -20,6 +20,8 @@ */ package jalview.datamodel; +import java.util.Locale; + import jalview.analysis.Rna; import jalview.analysis.SecStrConsensus.SimpleBP; import jalview.analysis.WUSSParseException; @@ -1225,7 +1227,7 @@ public class AlignmentAnnotation { if (seqname && this.sequenceRef != null) { - int i = description.toLowerCase().indexOf(""); + int i = description.toLowerCase(Locale.ROOT).indexOf(""); if (i > -1) { // move the html tag to before the sequence reference. diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java index 511287b..4a5c888 100755 --- a/src/jalview/datamodel/DBRefEntry.java +++ b/src/jalview/datamodel/DBRefEntry.java @@ -20,6 +20,8 @@ */ package jalview.datamodel; +import java.util.Locale; + import jalview.api.DBRefEntryI; import jalview.util.DBRefUtils; import jalview.util.MapList; @@ -95,7 +97,7 @@ public class DBRefEntry implements DBRefEntryI Mapping map,boolean isCanonical) { - this.source = source.toUpperCase(); + this.source = source.toUpperCase(Locale.ROOT); setVersion(version); this.accessionId = accessionId; this.map = map; @@ -306,7 +308,7 @@ public class DBRefEntry implements DBRefEntryI public void setAccessionId(String accessionId) { this.accessionId = accessionId; -// this.accessionId = (accessionId == null ? "" : accessionId).toUpperCase(); +// this.accessionId = (accessionId == null ? "" : accessionId).toUpperCase(Locale.ROOT); } /** @@ -317,7 +319,7 @@ public class DBRefEntry implements DBRefEntryI { this.source = source; -// this.source = (source == null ? "" : source).toUpperCase(); +// this.source = (source == null ? "" : source).toUpperCase(Locale.ROOT); // this.canonicalSourceName = DBRefUtils.getCanonicalName(this.source); // this.sourceKey = DBRefSource.getSourceKey(this.canonicalSourceName); } @@ -326,7 +328,7 @@ public class DBRefEntry implements DBRefEntryI public void setVersion(String version) { this.version = version; - this.ucversion = (version == null ? null : version.toUpperCase()); + this.ucversion = (version == null ? null : version.toUpperCase(Locale.ROOT)); } @Override diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java index 2f94884..2d2ae4f 100755 --- a/src/jalview/datamodel/DBRefSource.java +++ b/src/jalview/datamodel/DBRefSource.java @@ -36,29 +36,31 @@ package jalview.datamodel; * @author JimP * */ +import java.util.Locale; + public class DBRefSource { public static final String UNIPROT = "UNIPROT"; - public static final String UP_NAME = "UNIPROT_NAME".toUpperCase(); + public static final String UP_NAME = "UNIPROT_NAME".toUpperCase(Locale.ROOT); /** * Uniprot Knowledgebase/TrEMBL as served from EMBL protein products. */ - public static final String UNIPROTKB = "UniProtKB/TrEMBL".toUpperCase(); + public static final String UNIPROTKB = "UniProtKB/TrEMBL".toUpperCase(Locale.ROOT); public static final String ENSEMBL = "ENSEMBL"; public static final String ENSEMBLGENOMES = "ENSEMBLGENOMES"; public static final String EMBL = "EMBL"; public static final String EMBLCDS = "EMBLCDS"; - public static final String EMBLCDSProduct = "EMBLCDSProtein".toUpperCase(); + public static final String EMBLCDSProduct = "EMBLCDSProtein".toUpperCase(Locale.ROOT); public static final String PDB = "PDB"; public static final String PFAM = "PFAM"; public static final String RFAM = "RFAM"; - public static final String GENEDB = "GeneDB".toUpperCase(); + public static final String GENEDB = "GeneDB".toUpperCase(Locale.ROOT); public static final String PDB_CANONICAL_NAME = PDB; @@ -146,7 +148,7 @@ public class DBRefSource // see if there is a primary reference that derived this reference. for (int i = allSources.length; --i >= 0;) { - if (ucversion.startsWith(allSources[i])) // BH 2019.01.25 .toUpperCase() unnecessary here for allSources + if (ucversion.startsWith(allSources[i])) // BH 2019.01.25 .toUpperCase(Locale.ROOT) unnecessary here for allSources { // by convention, many secondary references inherit the primary // reference's diff --git a/src/jalview/datamodel/MappedFeatures.java b/src/jalview/datamodel/MappedFeatures.java index d652a97..f145d93 100644 --- a/src/jalview/datamodel/MappedFeatures.java +++ b/src/jalview/datamodel/MappedFeatures.java @@ -20,6 +20,8 @@ */ package jalview.datamodel; +import java.util.Locale; + import java.util.HashSet; import java.util.List; import java.util.Set; @@ -199,12 +201,12 @@ public class MappedFeatures * e.g. C,G,T gives variants G and T for base C */ Set variantPeptides = new HashSet<>(); - String[] alleles = alls.toUpperCase().split(","); + String[] alleles = alls.toUpperCase(Locale.ROOT).split(","); StringBuilder vars = new StringBuilder(); for (String allele : alleles) { - allele = allele.trim().toUpperCase(); + allele = allele.trim().toUpperCase(Locale.ROOT); if (allele.length() > 1 || "-".equals(allele)) { continue; // multi-locus variant @@ -220,7 +222,7 @@ public class MappedFeatures */ final int i = cdsPos == codonPos[0] ? 0 : (cdsPos == codonPos[1] ? 1 : 2); - variantCodon[i] = allele.toUpperCase().charAt(0); + variantCodon[i] = allele.toUpperCase(Locale.ROOT).charAt(0); if (variantCodon[i] == baseCodon[i]) { continue; diff --git a/src/jalview/datamodel/features/FeatureMatcher.java b/src/jalview/datamodel/features/FeatureMatcher.java index e9fb9b2..69f80f2 100644 --- a/src/jalview/datamodel/features/FeatureMatcher.java +++ b/src/jalview/datamodel/features/FeatureMatcher.java @@ -20,6 +20,8 @@ */ package jalview.datamodel.features; +import java.util.Locale; + import jalview.datamodel.SequenceFeature; import jalview.util.MessageManager; import jalview.util.matcher.Condition; @@ -163,12 +165,12 @@ public class FeatureMatcher implements FeatureMatcherI firstField = descriptor.substring(0, nextSpacePos); leftToParse = descriptor.substring(nextSpacePos + 1).trim(); } - String lower = firstField.toLowerCase(); - if (lower.startsWith(LABEL.toLowerCase())) + String lower = firstField.toLowerCase(Locale.ROOT); + if (lower.startsWith(LABEL.toLowerCase(Locale.ROOT))) { byLabel = true; } - else if (lower.startsWith(SCORE.toLowerCase())) + else if (lower.startsWith(SCORE.toLowerCase(Locale.ROOT))) { byScore = true; } @@ -351,7 +353,7 @@ public class FeatureMatcher implements FeatureMatcherI } Condition condition = matcher.getCondition(); - sb.append(SPACE).append(condition.toString().toLowerCase()); + sb.append(SPACE).append(condition.toString().toLowerCase(Locale.ROOT)); if (condition.isNumeric()) { sb.append(SPACE).append(matcher.getPattern()); diff --git a/src/jalview/datamodel/features/FeatureMatcherSet.java b/src/jalview/datamodel/features/FeatureMatcherSet.java index 3743278..ee4bf12 100644 --- a/src/jalview/datamodel/features/FeatureMatcherSet.java +++ b/src/jalview/datamodel/features/FeatureMatcherSet.java @@ -20,6 +20,8 @@ */ package jalview.datamodel.features; +import java.util.Locale; + import jalview.datamodel.SequenceFeature; import jalview.util.MessageManager; @@ -257,7 +259,7 @@ public class FeatureMatcherSet implements FeatureMatcherSetI if (!first) { String joiner = andConditions ? AND_18N : OR_I18N; - sb.append(SPACE).append(joiner.toLowerCase()).append(SPACE); + sb.append(SPACE).append(joiner.toLowerCase(Locale.ROOT)).append(SPACE); } first = false; if (multiple) diff --git a/src/jalview/ext/ensembl/EnsemblInfo.java b/src/jalview/ext/ensembl/EnsemblInfo.java index 97ad242..e2d2725 100644 --- a/src/jalview/ext/ensembl/EnsemblInfo.java +++ b/src/jalview/ext/ensembl/EnsemblInfo.java @@ -20,6 +20,8 @@ */ package jalview.ext.ensembl; +import java.util.Locale; + import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefSource; import jalview.util.JSONUtils; @@ -94,7 +96,7 @@ public class EnsemblInfo extends EnsemblRestClient { fetchDivisions(); } - return divisions.get(division.toUpperCase()); + return divisions.get(division.toUpperCase(Locale.ROOT)); } /** @@ -108,7 +110,7 @@ public class EnsemblInfo extends EnsemblRestClient /* * for convenience, pre-fill ensembl.org as the domain for "ENSEMBL" */ - divisions.put(DBRefSource.ENSEMBL.toUpperCase(), ensemblDomain); + divisions.put(DBRefSource.ENSEMBL.toUpperCase(Locale.ROOT), ensemblDomain); try { @SuppressWarnings("unchecked") @@ -118,7 +120,7 @@ public class EnsemblInfo extends EnsemblRestClient while (rvals.hasNext()) { String division = rvals.next().toString(); - divisions.put(division.toUpperCase(), ensemblGenomesDomain); + divisions.put(division.toUpperCase(Locale.ROOT), ensemblGenomesDomain); } } catch (IOException | ParseException | NumberFormatException e) { diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index 18d8e05..2a43244 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -20,6 +20,8 @@ */ package jalview.ext.jmol; +import java.util.Locale; + import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; import jalview.datamodel.PDBEntry; @@ -115,7 +117,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener // } // ; // instead, we distinguish .cif from non-.cif by filename - setStructureFileType(getDataName().toLowerCase().endsWith(".cif") + setStructureFileType(getDataName().toLowerCase(Locale.ROOT).endsWith(".cif") ? PDBEntry.Type.MMCIF.toString() : "PDB"); diff --git a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java index ced22fa..02b7136 100644 --- a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java +++ b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java @@ -20,6 +20,8 @@ */ package jalview.ext.rbvi.chimera; +import java.util.Locale; + import java.awt.Color; import java.util.ArrayList; import java.util.Arrays; @@ -181,7 +183,7 @@ public class ChimeraCommands extends StructureCommandsBase * Chimera treats an attribute name ending in 'color' as colour-valued; * Jalview doesn't, so prevent this by appending an underscore */ - if (attName.toUpperCase().endsWith("COLOR")) + if (attName.toUpperCase(Locale.ROOT).endsWith("COLOR")) { attName += "_"; } diff --git a/src/jalview/fts/core/FTSRestClient.java b/src/jalview/fts/core/FTSRestClient.java index b1cfc53..0bca070 100644 --- a/src/jalview/fts/core/FTSRestClient.java +++ b/src/jalview/fts/core/FTSRestClient.java @@ -20,6 +20,8 @@ */ package jalview.fts.core; +import java.util.Locale; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -171,7 +173,7 @@ public abstract class FTSRestClient implements FTSRestClientI public DataTypeI getDataType() { final String[] dataTypeString = lineData[2].split("\\|"); - final String classString = dataTypeString[0].toUpperCase(); + final String classString = dataTypeString[0].toUpperCase(Locale.ROOT); return new DataTypeI() { @@ -182,7 +184,7 @@ public abstract class FTSRestClient implements FTSRestClientI if (dataTypeString.length > 1 && dataTypeString[1] != null) { - switch (dataTypeString[1].toUpperCase()) + switch (dataTypeString[1].toUpperCase(Locale.ROOT)) { case "T": case "TRUE": diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index c5b90a9..8deff01 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -484,9 +486,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } }); - if (Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase() + if (Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase(Locale.ROOT) .indexOf("devel") > -1 - || Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase() + || Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase(Locale.ROOT) .indexOf("test") > -1) { formatMenu.add(vsel); @@ -4297,7 +4299,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, jws2servs.attachWSMenuEntry(webService, me); for (Jws2Instance sv : jws2servs.getServices()) { - if (sv.description.toLowerCase().contains("jpred")) + if (sv.description.toLowerCase(Locale.ROOT).contains("jpred")) { for (JMenuItem jmi : legacyItems) { diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index d84287f..568ca47 100644 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import jalview.api.FeatureRenderer; import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; @@ -337,7 +339,7 @@ public class AnnotationExporter extends JPanel boolean nucleotide = ap.av.isNucleotide(); String complement = nucleotide - ? MessageManager.getString("label.protein").toLowerCase() + ? MessageManager.getString("label.protein").toLowerCase(Locale.ROOT) : "CDS"; JLabel label = new JLabel( MessageManager.formatMessage("label.include_linked_features", diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 5a681f1..21c45e9 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import jalview.analysis.AlignSeq; import jalview.analysis.AlignmentUtils; import jalview.datamodel.Alignment; @@ -754,12 +756,12 @@ public class AnnotationLabels extends JPanel // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature // tooltips String desc = aa.getDescription(true).trim(); - if (!desc.toLowerCase().startsWith(HTML_START_TAG)) + if (!desc.toLowerCase(Locale.ROOT).startsWith(HTML_START_TAG)) { tooltip.append(HTML_START_TAG); desc = desc.replace("<", "<"); } - else if (desc.toLowerCase().endsWith(HTML_END_TAG)) + else if (desc.toLowerCase(Locale.ROOT).endsWith(HTML_END_TAG)) { desc = desc.substring(0, desc.length() - HTML_END_TAG.length()); } diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 458abc6..217d2b1 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -434,7 +436,7 @@ public class AppJmol extends StructureViewerBase jmb.jmolViewer.renderScreenImage(g, width, height); } }; - String view = MessageManager.getString("action.view").toLowerCase(); + String view = MessageManager.getString("action.view").toLowerCase(Locale.ROOT); ImageExporter exporter = new ImageExporter(writer, getProgressIndicator(), type, getTitle()); exporter.doExport(null, this, width, height, view); diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 67ef952..666fb4e 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -1055,7 +1057,7 @@ public class Desktop extends jalview.jbgui.GDesktop String url = (history instanceof JTextField ? ((JTextField) history).getText() : ((JComboBox) history).getEditor().getItem().toString().trim()); - if (url.toLowerCase().endsWith(".jar")) { + if (url.toLowerCase(Locale.ROOT).endsWith(".jar")) { if (viewport != null) { new FileLoader().LoadFile(viewport, url, DataSourceType.URL, FileFormat.Jalview); } else { @@ -1181,7 +1183,7 @@ public class Desktop extends jalview.jbgui.GDesktop // message.append("
...Checking latest version...
"); } else if (!latestVersion.equals(Cache.getProperty("VERSION"))) { boolean red = false; - if (Cache.getProperty("VERSION").toLowerCase().indexOf("automated build") == -1) { + if (Cache.getProperty("VERSION").toLowerCase(Locale.ROOT).indexOf("automated build") == -1) { red = true; // Displayed when code version and jnlp version do not match and code // version is not a development build @@ -2669,7 +2671,7 @@ public class Desktop extends jalview.jbgui.GDesktop continue; } java.net.URI uri = new java.net.URI(s); - if (uri.getScheme().toLowerCase().startsWith("http")) { + if (uri.getScheme().toLowerCase(Locale.ROOT).startsWith("http")) { protocols.add(DataSourceType.URL); files.add(uri.toString()); } else { @@ -2706,7 +2708,7 @@ public class Desktop extends jalview.jbgui.GDesktop // resolve any .lnk files in the file drop for (int f = 0; f < files.size(); f++) { - String source = files.get(f).toString().toLowerCase(); + String source = files.get(f).toString().toLowerCase(Locale.ROOT); if (protocols.get(f).equals(DataSourceType.FILE) && (source.endsWith(".lnk") || source.endsWith(".url") || source.endsWith(".site"))) { try { diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index e636455..572ada6 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -1529,7 +1531,7 @@ public class FeatureSettings extends JPanel String text = MessageManager.formatMessage("label.show_linked_features", nucleotide ? MessageManager.getString("label.protein") - .toLowerCase() + .toLowerCase(Locale.ROOT) : "CDS"); showComplement = new JCheckBox(text); showComplement.addActionListener(new ActionListener() diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index df56986..93dcadf 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.FocusAdapter; @@ -335,7 +337,7 @@ public class Finder extends GFinder if (idMatch.size() > 0 && searchResults.getCount() > 0) { message.append(" ").append( - MessageManager.getString("label.and").toLowerCase()) + MessageManager.getString("label.and").toLowerCase(Locale.ROOT)) .append(" "); } message.append(MessageManager.formatMessage( diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java index 8d62433..7bdcb2e 100644 --- a/src/jalview/gui/JDatabaseTree.java +++ b/src/jalview/gui/JDatabaseTree.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import jalview.util.MessageManager; import jalview.ws.seqfetcher.DbSourceProxy; @@ -227,11 +229,11 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener if (child.getUserObject() instanceof DbSourceProxy) { names[i] = ((DbSourceProxy) child.getUserObject()).getDbName() - .toLowerCase(); + .toLowerCase(Locale.ROOT); } else { - names[i] = ((String) child.getUserObject()).toLowerCase(); + names[i] = ((String) child.getUserObject()).toLowerCase(Locale.ROOT); sortTreeNodes(child); } } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 2a7fb9f..6b32efa 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; @@ -1125,7 +1127,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener for (int d = 0; d < nd; d++) { DBRefEntry e = dbr.get(d); - String src = e.getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase(); + String src = e.getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase(Locale.ROOT); Object[] sarray = commonDbrefs.get(src); if (sarray == null) { @@ -1171,7 +1173,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener boolean usingNames = false; // Now see which parts of the group apply for this URL String ltarget = urlLink.getTarget(); // jalview.util.DBRefUtils.getCanonicalName(urlLink.getTarget()); - Object[] idset = commonDbrefs.get(ltarget.toUpperCase()); + Object[] idset = commonDbrefs.get(ltarget.toUpperCase(Locale.ROOT)); String[] seqstr, ids; // input to makeUrl if (idset != null) { diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 849c278..9f9de6e 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -21,6 +21,8 @@ package jalview.gui; +import java.util.Locale; + import java.awt.event.ItemEvent; import java.util.ArrayList; import java.util.Collection; @@ -1019,7 +1021,7 @@ public class StructureChooser extends GStructureChooser if (pdbIdStr.split(":").length > 1) { pdbEntry.setId(pdbIdStr.split(":")[0]); - pdbEntry.setChainCode(pdbIdStr.split(":")[1].toUpperCase()); + pdbEntry.setChainCode(pdbIdStr.split(":")[1].toUpperCase(Locale.ROOT)); } else { @@ -1246,7 +1248,7 @@ public class StructureChooser extends GStructureChooser // TODO move this pdb id search into the PDB specific // FTSSearchEngine // for moment, it will work fine as is because it is self-contained - String searchTerm = text.toLowerCase(); + String searchTerm = text.toLowerCase(Locale.ROOT); searchTerm = searchTerm.split(":")[0]; // System.out.println(">>>>> search term : " + searchTerm); List wantedFields = new ArrayList<>(); diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 2d8e729..b730df4 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import jalview.analysis.AlignmentSorter; import jalview.analysis.AverageDistanceTree; import jalview.analysis.NJTree; @@ -693,7 +695,7 @@ public class TreePanel extends GTreePanel String tree = MessageManager.getString("label.tree"); ImageExporter exporter = new ImageExporter(writer, null, imageFormat, tree); - exporter.doExport(null, this, width, height, tree.toLowerCase()); + exporter.doExport(null, this, width, height, tree.toLowerCase(Locale.ROOT)); } /** @@ -723,7 +725,7 @@ public class TreePanel extends GTreePanel // search dbrefs, features and annotation List refs = jalview.util.DBRefUtils .selectRefs(sq.getDBRefs(), new String[] - { labelClass.toUpperCase() }); + { labelClass.toUpperCase(Locale.ROOT) }); if (refs != null) { for (int i = 0, ni = refs.size(); i < ni; i++) @@ -786,7 +788,7 @@ public class TreePanel extends GTreePanel * i18n description of Neighbour Joining or Average Distance method */ String treecalcnm = MessageManager - .getString("label.tree_calc_" + treeType.toLowerCase()); + .getString("label.tree_calc_" + treeType.toLowerCase(Locale.ROOT)); /* * short score model name (long description can be too long) diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 4846049..c3f132b 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import jalview.bin.Cache; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; @@ -205,8 +207,8 @@ public class UserDefinedColours extends GUserDefinedColours { int row = i / cols + 1; int index = (row * cols) + i; - JButton button = makeButton(ResidueProperties.aa[i].toLowerCase(), - ResidueProperties.aa[i].toLowerCase(), lowerCaseButtons, i); + JButton button = makeButton(ResidueProperties.aa[i].toLowerCase(Locale.ROOT), + ResidueProperties.aa[i].toLowerCase(Locale.ROOT), lowerCaseButtons, i); buttonPanel.add(button, index); } diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 0773a7b..ee1b473 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import java.util.Locale; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -545,7 +547,7 @@ public class WebserviceInfo extends GWebserviceInfo { return null; } - String lowertxt = text.toLowerCase(); + String lowertxt = text.toLowerCase(Locale.ROOT); int htmlpos = leaveFirst ? -1 : lowertxt.indexOf(" -1)) // possible Markup Language data i.e HTML, // RNAML, XML { - String upper = data.toUpperCase(); + String upper = data.toUpperCase(Locale.ROOT); if (upper.substring(lessThan).startsWith(" 0) && (i < (filename.length() - 1))) { - return filename.substring(i + 1).toLowerCase(); + return filename.substring(i + 1).toLowerCase(Locale.ROOT); } ; @@ -150,7 +152,7 @@ public class JalviewFileFilter extends FileFilter filters = new LinkedHashMap<>(5); } - filters.put(extension.toLowerCase(), this); + filters.put(extension.toLowerCase(Locale.ROOT), this); fullDescription = null; } diff --git a/src/jalview/io/JalviewFileView.java b/src/jalview/io/JalviewFileView.java index 52d130c..b90bd7a 100755 --- a/src/jalview/io/JalviewFileView.java +++ b/src/jalview/io/JalviewFileView.java @@ -20,6 +20,8 @@ */ package jalview.io; +import java.util.Locale; + import jalview.util.MessageManager; import java.io.File; @@ -47,7 +49,7 @@ public class JalviewFileView extends FileView String exts = ff.getExtensions(); for (String ext : exts.split(",")) { - ext = ext.trim().toLowerCase(); + ext = ext.trim().toLowerCase(Locale.ROOT); extensions.put(ext, desc + ("jar".equals(ext) ? " (old)" : "")); } @@ -136,7 +138,7 @@ public class JalviewFileView extends FileView if ((i > 0) && (i < (s.length() - 1))) { - ext = s.substring(i + 1).toLowerCase(); + ext = s.substring(i + 1).toLowerCase(Locale.ROOT); } return ext; diff --git a/src/jalview/io/JnetAnnotationMaker.java b/src/jalview/io/JnetAnnotationMaker.java index 6828202..27fc869 100755 --- a/src/jalview/io/JnetAnnotationMaker.java +++ b/src/jalview/io/JnetAnnotationMaker.java @@ -20,6 +20,8 @@ */ package jalview.io; +import java.util.Locale; + import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; @@ -88,7 +90,7 @@ public class JnetAnnotationMaker while (i < preds.length) { - String id = preds[i].getName().toUpperCase(); + String id = preds[i].getName().toUpperCase(Locale.ROOT); if (id.startsWith("LUPAS") || id.startsWith("JNET") || id.startsWith("JPRED")) diff --git a/src/jalview/io/MSFfile.java b/src/jalview/io/MSFfile.java index df2bed2..e954703 100755 --- a/src/jalview/io/MSFfile.java +++ b/src/jalview/io/MSFfile.java @@ -20,6 +20,8 @@ */ package jalview.io; +import java.util.Locale; + import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.util.Comparison; @@ -184,7 +186,7 @@ public class MSFfile extends AlignFile public int checkSum(String seq) { int check = 0; - String sequence = seq.toUpperCase(); + String sequence = seq.toUpperCase(Locale.ROOT); for (int i = 0; i < sequence.length(); i++) { diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java index f3eaa45..ec5d267 100755 --- a/src/jalview/io/NewickFile.java +++ b/src/jalview/io/NewickFile.java @@ -26,6 +26,8 @@ // TODO: Extended SequenceNodeI to hold parsed NHX strings package jalview.io; +import java.util.Locale; + import jalview.datamodel.SequenceNode; import jalview.util.MessageManager; @@ -656,7 +658,7 @@ public class NewickFile extends FileParse try { // parse out code/value pairs - if (code.toLowerCase().equals("b")) + if (code.toLowerCase(Locale.ROOT).equals("b")) { int v = -1; Float iv = Float.valueOf(value); diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 8e4e783..62b723d 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -20,6 +20,8 @@ */ package jalview.io; +import java.util.Locale; + import java.util.Collection; import java.util.Comparator; import java.util.LinkedHashMap; @@ -273,7 +275,7 @@ public class SequenceAnnotationReport * truncate overlong descriptions unless they contain an href * before the truncation point (as truncation could leave corrupted html) */ - int linkindex = description.toLowerCase().indexOf(" -1 && linkindex < MAX_DESCRIPTION_LENGTH; if (description.length() > MAX_DESCRIPTION_LENGTH && !hasLink) @@ -400,8 +402,8 @@ public class SequenceAnnotationReport + "\" target=\"" + urllink.get(0) + "\">" - + (urllink.get(0).toLowerCase() - .equals(urllink.get(1).toLowerCase()) ? urllink + + (urllink.get(0).toLowerCase(Locale.ROOT) + .equals(urllink.get(1).toLowerCase(Locale.ROOT)) ? urllink .get(0) : (urllink.get(0) + ":" + urllink .get(1))) + "
"); diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index 8b26757..c8c9c8a 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -23,6 +23,8 @@ */ package jalview.io; +import java.util.Locale; + import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; @@ -1110,7 +1112,7 @@ public class StockholmFile extends AlignFile } else { - key = type2id(aa.label.toLowerCase()); + key = type2id(aa.label.toLowerCase(Locale.ROOT)); if (key == null) { label = aa.label; diff --git a/src/jalview/io/gff/ExonerateHelper.java b/src/jalview/io/gff/ExonerateHelper.java index da0c245..9ce4cc6 100644 --- a/src/jalview/io/gff/ExonerateHelper.java +++ b/src/jalview/io/gff/ExonerateHelper.java @@ -20,6 +20,8 @@ */ package jalview.io.gff; +import java.util.Locale; + import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.AlignmentI; import jalview.datamodel.MappingType; @@ -341,7 +343,7 @@ public class ExonerateHelper extends Gff2Helper // e.g. exonerate:protein2genome:local if (model != null) { - String mdl = model.toLowerCase(); + String mdl = model.toLowerCase(Locale.ROOT); if (mdl.contains(PROTEIN2DNA) || mdl.contains(PROTEIN2GENOME) || mdl.contains(CODING2CODING) || mdl.contains(CODING2GENOME) || mdl.contains(CDNA2GENOME) || mdl.contains(GENOME2GENOME)) diff --git a/src/jalview/io/packed/ParsePackedSet.java b/src/jalview/io/packed/ParsePackedSet.java index d40446d..37dd66b 100644 --- a/src/jalview/io/packed/ParsePackedSet.java +++ b/src/jalview/io/packed/ParsePackedSet.java @@ -20,6 +20,8 @@ */ package jalview.io.packed; +import java.util.Locale; + import jalview.api.FeatureColourI; import jalview.datamodel.AlignmentI; import jalview.io.AppletFormatAdapter; @@ -235,7 +237,7 @@ public class ParsePackedSet String type = args[i++]; final String file = args[i++]; final JvDataType jtype = DataProvider.JvDataType - .valueOf(type.toUpperCase()); + .valueOf(type.toUpperCase(Locale.ROOT)); if (jtype != null) { final FileParse fp; @@ -254,7 +256,7 @@ public class ParsePackedSet else { System.out.println("Couldn't parse source type token '" - + type.toUpperCase() + "'"); + + type.toUpperCase(Locale.ROOT) + "'"); } } if (i < args.length) diff --git a/src/jalview/io/vcf/VCFLoader.java b/src/jalview/io/vcf/VCFLoader.java index f965c4e..dadb532 100644 --- a/src/jalview/io/vcf/VCFLoader.java +++ b/src/jalview/io/vcf/VCFLoader.java @@ -20,6 +20,8 @@ */ package jalview.io.vcf; +import java.util.Locale; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -431,7 +433,7 @@ public class VCFLoader + DEFAULT_REFERENCE + ":" + DEFAULT_SPECIES); reference = DEFAULT_REFERENCE; // default to GRCh37 if not specified } - reference = reference.toLowerCase(); + reference = reference.toLowerCase(Locale.ROOT); /* * for a non-human species, or other assembly identifier, @@ -446,7 +448,7 @@ public class VCFLoader String[] tokens = token.split("="); if (tokens.length == 2) { - if (reference.contains(tokens[0].trim().toLowerCase())) + if (reference.contains(tokens[0].trim().toLowerCase(Locale.ROOT))) { vcfAssembly = tokens[1].trim(); break; @@ -463,7 +465,7 @@ public class VCFLoader String[] tokens = token.split("="); if (tokens.length == 2) { - if (reference.contains(tokens[0].trim().toLowerCase())) + if (reference.contains(tokens[0].trim().toLowerCase(Locale.ROOT))) { vcfSpecies = tokens[1].trim(); break; @@ -568,7 +570,7 @@ public class VCFLoader { for (Pattern p : filters) { - if (p.matcher(id.toUpperCase()).matches()) + if (p.matcher(id.toUpperCase(Locale.ROOT)).matches()) { return true; } @@ -662,7 +664,7 @@ public class VCFLoader { try { - patterns.add(Pattern.compile(token.toUpperCase())); + patterns.add(Pattern.compile(token.toUpperCase(Locale.ROOT))); } catch (PatternSyntaxException e) { System.err.println("Invalid pattern ignored: " + token); @@ -1033,7 +1035,7 @@ public class VCFLoader */ String consequence = getConsequenceForAlleleAndFeature(variant, CSQ_FIELD, altAlleleIndex, csqAlleleFieldIndex, - csqAlleleNumberFieldIndex, seq.getName().toLowerCase(), + csqAlleleNumberFieldIndex, seq.getName().toLowerCase(Locale.ROOT), csqFeatureFieldIndex); /* @@ -1226,7 +1228,7 @@ public class VCFLoader { String featureIdentifier = csqFields[featureFieldIndex]; if (featureIdentifier.length() > 4 - && seqName.indexOf(featureIdentifier.toLowerCase()) > -1) + && seqName.indexOf(featureIdentifier.toLowerCase(Locale.ROOT)) > -1) { /* * feature (transcript) matched - now check for allele match diff --git a/src/jalview/javascript/log4j/Level.java b/src/jalview/javascript/log4j/Level.java index 5691a47..582f2de 100644 --- a/src/jalview/javascript/log4j/Level.java +++ b/src/jalview/javascript/log4j/Level.java @@ -1,5 +1,7 @@ package jalview.javascript.log4j; +import java.util.Locale; + import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; @@ -162,7 +164,7 @@ public class Level extends Priority implements Serializable { return defaultLevel; } - String s = sArg.toUpperCase(); + String s = sArg.toUpperCase(Locale.ROOT); if (s.equals(ALL_NAME)) { diff --git a/src/jalview/json/binding/biojson/v1/ColourSchemeMapper.java b/src/jalview/json/binding/biojson/v1/ColourSchemeMapper.java index b3422ab..6b877bf 100644 --- a/src/jalview/json/binding/biojson/v1/ColourSchemeMapper.java +++ b/src/jalview/json/binding/biojson/v1/ColourSchemeMapper.java @@ -20,6 +20,8 @@ */ package jalview.json.binding.biojson.v1; +import java.util.Locale; + import jalview.datamodel.AnnotatedCollectionI; import jalview.schemes.Blosum62ColourScheme; import jalview.schemes.BuriedColourScheme; @@ -62,7 +64,7 @@ public class ColourSchemeMapper public static ColourSchemeI getJalviewColourScheme( String colourSchemeName, AnnotatedCollectionI annotCol) { - switch (colourSchemeName.toUpperCase()) + switch (colourSchemeName.toUpperCase(Locale.ROOT)) { case "ZAPPO": return csZappo; diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index ffd942f..9b6741b 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -20,6 +20,8 @@ */ package jalview.project; +import java.util.Locale; + import static jalview.math.RotatableMatrix.Axis.X; import static jalview.math.RotatableMatrix.Axis.Y; import static jalview.math.RotatableMatrix.Axis.Z; @@ -2076,8 +2078,8 @@ public class Jalview2XML final PDBEntry pdbentry = bindingModel.getPdbEntry(peid); final String pdbId = pdbentry.getId(); if (!pdbId.equals(entry.getId()) - && !(entry.getId().length() > 4 && entry.getId().toLowerCase() - .startsWith(pdbId.toLowerCase()))) + && !(entry.getId().length() > 4 && entry.getId().toLowerCase(Locale.ROOT) + .startsWith(pdbId.toLowerCase(Locale.ROOT)))) { /* * not interested in a binding to a different PDB entry here @@ -2645,7 +2647,7 @@ public class Jalview2XML for (int i = 0; i < colours.length; i++) { Colour col = new Colour(); - col.setName(ResidueProperties.aa[i].toLowerCase()); + col.setName(ResidueProperties.aa[i].toLowerCase(Locale.ROOT)); col.setRGB(jalview.util.Format.getHexString(colours[i])); // jbucs.addColour(col); jbucs.getColour().add(col); diff --git a/src/jalview/schemes/ColourSchemeLoader.java b/src/jalview/schemes/ColourSchemeLoader.java index 141ef10..061ccd4 100644 --- a/src/jalview/schemes/ColourSchemeLoader.java +++ b/src/jalview/schemes/ColourSchemeLoader.java @@ -20,6 +20,8 @@ */ package jalview.schemes; +import java.util.Locale; + import jalview.xml.binding.jalview.JalviewUserColours; import java.awt.Color; @@ -92,7 +94,7 @@ public class ColourSchemeLoader Color color = new Color( Integer.parseInt(jucs.getColour().get(i).getRGB(), 16)); - if (name.toLowerCase().equals(name)) + if (name.toLowerCase(Locale.ROOT).equals(name)) { caseSensitive = true; lowerCase[index] = color; diff --git a/src/jalview/schemes/ColourSchemes.java b/src/jalview/schemes/ColourSchemes.java index d31fbba..faada0e 100644 --- a/src/jalview/schemes/ColourSchemes.java +++ b/src/jalview/schemes/ColourSchemes.java @@ -20,6 +20,8 @@ */ package jalview.schemes; +import java.util.Locale; + import jalview.api.AlignViewportI; import jalview.datamodel.AnnotatedCollectionI; import jalview.datamodel.SequenceCollectionI; @@ -104,7 +106,7 @@ public class ColourSchemes * name is lower-case for non-case-sensitive lookup * (name in the colour keeps its true case) */ - String lower = name.toLowerCase(); + String lower = name.toLowerCase(Locale.ROOT); if (schemes.containsKey(lower)) { System.err @@ -122,7 +124,7 @@ public class ColourSchemes { if (name != null) { - schemes.remove(name.toLowerCase()); + schemes.remove(name.toLowerCase(Locale.ROOT)); } } @@ -148,7 +150,7 @@ public class ColourSchemes { return null; } - ColourSchemeI cs = schemes.get(name.toLowerCase()); + ColourSchemeI cs = schemes.get(name.toLowerCase(Locale.ROOT)); return cs == null ? null : cs.getInstance(viewport, forData); } @@ -193,6 +195,6 @@ public class ColourSchemes { return false; } - return schemes.containsKey(name.toLowerCase()); + return schemes.containsKey(name.toLowerCase(Locale.ROOT)); } } diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index 0d36f4f..e5bda58 100644 --- a/src/jalview/schemes/FeatureColour.java +++ b/src/jalview/schemes/FeatureColour.java @@ -20,6 +20,8 @@ */ package jalview.schemes; +import java.util.Locale; + import jalview.api.FeatureColourI; import jalview.datamodel.SequenceFeature; import jalview.datamodel.features.FeatureMatcher; @@ -194,19 +196,19 @@ public class FeatureColour implements FeatureColourI "Expected either 'label' or a colour specification in the line: " + descriptor); } - if (nextToken.toLowerCase().startsWith(LABEL)) + if (nextToken.toLowerCase(Locale.ROOT).startsWith(LABEL)) { byLabel = true; // get the token after the next delimiter: mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); } - else if (nextToken.toLowerCase().startsWith(SCORE)) + else if (nextToken.toLowerCase(Locale.ROOT).startsWith(SCORE)) { mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); } - else if (nextToken.toLowerCase().startsWith(ATTRIBUTE)) + else if (nextToken.toLowerCase(Locale.ROOT).startsWith(ATTRIBUTE)) { byAttribute = true; attName = (gcol.hasMoreTokens() ? gcol.nextToken() : null); @@ -304,7 +306,7 @@ public class FeatureColour implements FeatureColourI } gcol.nextToken(); // skip next '|' - if (tok.toLowerCase().startsWith(ABSOLUTE)) + if (tok.toLowerCase(Locale.ROOT).startsWith(ABSOLUTE)) { minval = gcol.nextToken(); gcol.nextToken(); // skip next '|' @@ -380,17 +382,17 @@ public class FeatureColour implements FeatureColourI { // threshold type and possibly a threshold value ttype = gcol.nextToken(); - if (ttype.toLowerCase().startsWith(BELOW)) + if (ttype.toLowerCase(Locale.ROOT).startsWith(BELOW)) { featureColour.setBelowThreshold(true); } - else if (ttype.toLowerCase().startsWith(ABOVE)) + else if (ttype.toLowerCase(Locale.ROOT).startsWith(ABOVE)) { featureColour.setAboveThreshold(true); } else { - if (!ttype.toLowerCase().startsWith("no")) + if (!ttype.toLowerCase(Locale.ROOT).startsWith("no")) { System.err.println( "Ignoring unrecognised threshold type : " + ttype); diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 5f84ca0..2eb303d 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -20,6 +20,8 @@ */ package jalview.schemes; +import java.util.Locale; + import jalview.analysis.GeneticCodes; import java.awt.Color; @@ -2347,7 +2349,7 @@ public class ResidueProperties { continue; } - nuc = nuc.toUpperCase(); + nuc = nuc.toUpperCase(Locale.ROOT); if (!result.contains(nuc)) { result.add(nuc); @@ -2366,7 +2368,7 @@ public class ResidueProperties { continue; } - res = res.toUpperCase(); + res = res.toUpperCase(Locale.ROOT); if (!result.contains(res)) { result.add(res); @@ -2391,7 +2393,7 @@ public class ResidueProperties return '0'; } Integer index = ResidueProperties.aa3Hash - .get(threeLetterCode.toUpperCase()); + .get(threeLetterCode.toUpperCase(Locale.ROOT)); return index == null ? '0' : aa[index].charAt(0); } } diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index d77f2f5..d55ffbf 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -20,6 +20,8 @@ */ package jalview.schemes; +import java.util.Locale; + import jalview.api.AlignViewportI; import jalview.datamodel.AnnotatedCollectionI; import jalview.util.ColorUtils; @@ -215,7 +217,7 @@ public class UserColourScheme extends ResidueColourScheme continue; } - if (residue.equals(residue.toLowerCase())) + if (residue.equals(residue.toLowerCase(Locale.ROOT))) { if (lowerCaseColours == null) { @@ -306,7 +308,7 @@ public class UserColourScheme extends ResidueColourScheme c = lowerCaseColours[index]; if (c != null && !c.equals(Color.white)) { - residue = residue.toLowerCase(); + residue = residue.toLowerCase(Locale.ROOT); if (colours.get(c) == null) { colours.put(c, new ArrayList()); diff --git a/src/jalview/structure/StructureImportSettings.java b/src/jalview/structure/StructureImportSettings.java index 9662fee..cbd59b1 100644 --- a/src/jalview/structure/StructureImportSettings.java +++ b/src/jalview/structure/StructureImportSettings.java @@ -20,6 +20,8 @@ */ package jalview.structure; +import java.util.Locale; + import jalview.datamodel.PDBEntry; import jalview.datamodel.PDBEntry.Type; @@ -130,7 +132,7 @@ public class StructureImportSettings String defaultStructureFileFormat) { StructureImportSettings.defaultStructureFileFormat = PDBEntry.Type - .valueOf(defaultStructureFileFormat.toUpperCase()); + .valueOf(defaultStructureFileFormat.toUpperCase(Locale.ROOT)); } public static String getDefaultPDBFileParser() @@ -147,7 +149,7 @@ public class StructureImportSettings public static void setDefaultPDBFileParser(String defaultPDBFileParser) { StructureImportSettings.defaultPDBFileParser = StructureParser - .valueOf(defaultPDBFileParser.toUpperCase()); + .valueOf(defaultPDBFileParser.toUpperCase(Locale.ROOT)); } } diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index 44773e9..748381f 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -20,6 +20,8 @@ */ package jalview.structures.models; +import java.util.Locale; + import java.awt.Color; import java.io.File; import java.io.IOException; @@ -931,7 +933,7 @@ public abstract class AAStructureBindingModel for (String reply : replies) { // return this error (Chimera only) to the user - if (reply.toLowerCase().contains("unequal numbers of atoms")) + if (reply.toLowerCase(Locale.ROOT).contains("unequal numbers of atoms")) { error += "; " + reply; } diff --git a/src/jalview/util/CaseInsensitiveString.java b/src/jalview/util/CaseInsensitiveString.java index a01c035..536671d 100644 --- a/src/jalview/util/CaseInsensitiveString.java +++ b/src/jalview/util/CaseInsensitiveString.java @@ -25,6 +25,8 @@ package jalview.util; * want to preserve case, but do not want to duplicate upper and lower case * variants */ +import java.util.Locale; + public final class CaseInsensitiveString { String value; @@ -72,6 +74,6 @@ public final class CaseInsensitiveString public int hashCode() { return value == null ? super.hashCode() - : value.toUpperCase().hashCode(); + : value.toUpperCase(Locale.ROOT).hashCode(); } } diff --git a/src/jalview/util/ColorUtils.java b/src/jalview/util/ColorUtils.java index 60129fb..5db333f 100644 --- a/src/jalview/util/ColorUtils.java +++ b/src/jalview/util/ColorUtils.java @@ -24,6 +24,8 @@ package jalview.util; +import java.util.Locale; + import java.awt.Color; import java.util.HashMap; import java.util.Map; @@ -324,7 +326,7 @@ public class ColorUtils return null; } Color col = null; - name = name.toLowerCase(); + name = name.toLowerCase(Locale.ROOT); // or make a static map; or use reflection on the field name switch (name) diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index ae0243e..bcb0bd3 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -20,6 +20,8 @@ */ package jalview.util; +import java.util.Locale; + import java.util.ArrayList; import java.util.BitSet; import java.util.HashMap; @@ -73,7 +75,7 @@ public class DBRefUtils // guarantee we always have lowercase entries for canonical string lookups for (String k : canonicalSourceNameLookup.keySet()) { - canonicalSourceNameLookup.put(k.toLowerCase(), + canonicalSourceNameLookup.put(k.toLowerCase(Locale.ROOT), canonicalSourceNameLookup.get(k)); } } @@ -98,7 +100,7 @@ public class DBRefUtils HashSet srcs = new HashSet(); for (String src : sources) { - srcs.add(src.toUpperCase()); + srcs.add(src.toUpperCase(Locale.ROOT)); } int nrefs = dbrefs.size(); @@ -107,7 +109,7 @@ public class DBRefUtils { DBRefEntry dbr = dbrefs.get(ib); String source = getCanonicalName(dbr.getSource()); - if (srcs.contains(source.toUpperCase())) + if (srcs.contains(source.toUpperCase(Locale.ROOT))) { res.add(dbr); } @@ -181,7 +183,7 @@ public class DBRefUtils { return null; } - String canonical = canonicalSourceNameLookup.get(source.toLowerCase()); + String canonical = canonicalSourceNameLookup.get(source.toLowerCase(Locale.ROOT)); return canonical == null ? source : canonical; } diff --git a/src/jalview/util/MessageManager.java b/src/jalview/util/MessageManager.java index bb94566..ba7da10 100644 --- a/src/jalview/util/MessageManager.java +++ b/src/jalview/util/MessageManager.java @@ -162,7 +162,7 @@ public class MessageManager */ public static String getStringOrReturn(String keyroot, String name) { - String smkey = keyroot + name.toLowerCase().replaceAll(" ", ""); + String smkey = keyroot + name.toLowerCase(Locale.ROOT).replaceAll(" ", ""); try { name = rb.getString(smkey); diff --git a/src/jalview/util/ParseHtmlBodyAndLinks.java b/src/jalview/util/ParseHtmlBodyAndLinks.java index 6713bbc..0f2d01d 100644 --- a/src/jalview/util/ParseHtmlBodyAndLinks.java +++ b/src/jalview/util/ParseHtmlBodyAndLinks.java @@ -20,6 +20,8 @@ */ package jalview.util; +import java.util.Locale; + import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; @@ -103,7 +105,7 @@ public class ParseHtmlBodyAndLinks return; } StringBuilder sb = new StringBuilder(description.length()); - if (description.toUpperCase().indexOf("") == -1) + if (description.toUpperCase(Locale.ROOT).indexOf("") == -1) { htmlContent = false; } @@ -129,7 +131,7 @@ public class ParseHtmlBodyAndLinks token = token.substring(0, startTag); } - if (tag != null && tag.toUpperCase().startsWith("A HREF=")) + if (tag != null && tag.toUpperCase(Locale.ROOT).startsWith("A HREF=")) { if (token.length() > 0) { diff --git a/src/jalview/util/StringUtils.java b/src/jalview/util/StringUtils.java index 1f114a8..bf5b87a 100644 --- a/src/jalview/util/StringUtils.java +++ b/src/jalview/util/StringUtils.java @@ -20,6 +20,8 @@ */ package jalview.util; +import java.util.Locale; + import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; @@ -409,9 +411,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 +429,7 @@ public class StringUtils { return null; } - String tmp2up = text.toUpperCase(); + String tmp2up = text.toUpperCase(Locale.ROOT); int startTag = tmp2up.indexOf(""); if (startTag > -1) { diff --git a/src/jalview/util/matcher/Matcher.java b/src/jalview/util/matcher/Matcher.java index 51e1828..e43ead2 100644 --- a/src/jalview/util/matcher/Matcher.java +++ b/src/jalview/util/matcher/Matcher.java @@ -20,6 +20,8 @@ */ package jalview.util.matcher; +import java.util.Locale; + import java.util.Objects; /** @@ -102,7 +104,7 @@ public class Matcher implements MatcherI patternType = PatternType.String; } - uppercasePattern = pattern == null ? null : pattern.toUpperCase(); + uppercasePattern = pattern == null ? null : pattern.toUpperCase(Locale.ROOT); // if we add regex conditions (e.g. matchesPattern), then // pattern should hold the raw regex, and @@ -172,7 +174,7 @@ public class Matcher implements MatcherI boolean matchesString(String compareTo) { boolean matched = false; - String upper = compareTo.toUpperCase().trim(); + String upper = compareTo.toUpperCase(Locale.ROOT).trim(); switch(condition) { case Matches: matched = upper.equals(uppercasePattern); diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 7daa7b4..9420465 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -20,6 +20,8 @@ */ package jalview.ws; +import java.util.Locale; + import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; @@ -243,7 +245,7 @@ public class DBRefFetcher implements Runnable */ void addSeqId(SequenceI seq, String key) { - key = key.toUpperCase(); + key = key.toUpperCase(Locale.ROOT); Vector seqs; if (seqRefs.containsKey(key)) @@ -397,7 +399,7 @@ public class DBRefFetcher implements Runnable DBRefEntry upref = uprefs.get(j); addSeqId(sequence, upref.getAccessionId()); queries.addElement( - upref.getAccessionId().toUpperCase()); + upref.getAccessionId().toUpperCase(Locale.ROOT)); } } else @@ -436,7 +438,7 @@ public class DBRefFetcher implements Runnable "Validated ID against PICR... (for what its worth):" + token); addSeqId(sequence, token); - queries.addElement(token.toUpperCase()); + queries.addElement(token.toUpperCase(Locale.ROOT)); } else { @@ -444,7 +446,7 @@ public class DBRefFetcher implements Runnable // System.out.println("Not querying source with // token="+token+"\n"); addSeqId(sequence, token); - queries.addElement(token.toUpperCase()); + queries.addElement(token.toUpperCase(Locale.ROOT)); } } } @@ -540,7 +542,7 @@ public class DBRefFetcher implements Runnable DBRefEntry ref = entryRefs.get(j); String accessionId = ref.getAccessionId(); // match up on accessionId - if (seqRefs.containsKey(accessionId.toUpperCase())) + if (seqRefs.containsKey(accessionId.toUpperCase(Locale.ROOT))) { Vector seqs = seqRefs.get(accessionId); for (int jj = 0; jj < seqs.size(); jj++) @@ -592,7 +594,7 @@ public class DBRefFetcher implements Runnable // sequenceMatches now contains the set of all sequences associated with // the returned db record final String retrievedSeqString = retrievedSeq.getSequenceAsString(); - String entrySeq = retrievedSeqString.toUpperCase(); + String entrySeq = retrievedSeqString.toUpperCase(Locale.ROOT); for (int m = 0; m < sequenceMatches.size(); m++) { sequence = sequenceMatches.elementAt(m); @@ -611,7 +613,7 @@ public class DBRefFetcher implements Runnable boolean remoteEnclosesLocal = false; String nonGapped = AlignSeq .extractGaps("-. ", sequence.getSequenceAsString()) - .toUpperCase(); + .toUpperCase(Locale.ROOT); int absStart = entrySeq.indexOf(nonGapped); if (absStart == -1) { @@ -731,10 +733,10 @@ public class DBRefFetcher implements Runnable String ngAlsq = AlignSeq .extractGaps("-. ", alseqs[alsq].getSequenceAsString()) - .toUpperCase(); + .toUpperCase(Locale.ROOT); int oldstrt = alseqs[alsq].getStart(); alseqs[alsq].setStart(sequence.getSequenceAsString() - .toUpperCase().indexOf(ngAlsq) + sequence.getStart()); + .toUpperCase(Locale.ROOT).indexOf(ngAlsq) + sequence.getStart()); if (oldstrt != alseqs[alsq].getStart()) { alseqs[alsq].setEnd( diff --git a/src/jalview/ws/dbsources/EmblFlatfileSource.java b/src/jalview/ws/dbsources/EmblFlatfileSource.java index 6536958..7d3c6dd 100644 --- a/src/jalview/ws/dbsources/EmblFlatfileSource.java +++ b/src/jalview/ws/dbsources/EmblFlatfileSource.java @@ -1,5 +1,7 @@ package jalview.ws.dbsources; +import java.util.Locale; + import java.io.File; import java.io.IOException; @@ -73,13 +75,13 @@ public abstract class EmblFlatfileSource extends EbiFileRetrievedProxy try { reply = dbFetch.fetchDataAsFile( - dbName.toLowerCase() + ":" + query.trim(), null, "gz"); + dbName.toLowerCase(Locale.ROOT) + ":" + query.trim(), null, "gz"); } catch (Exception e) { stopQuery(); throw new Exception( String.format("EBI EMBL retrieval failed for %s:%s", - dbName.toLowerCase(), query.trim()), + dbName.toLowerCase(Locale.ROOT), query.trim()), e); } return getEmblSequenceRecords(dbName, query, reply); diff --git a/src/jalview/ws/dbsources/EmblXmlSource.java b/src/jalview/ws/dbsources/EmblXmlSource.java index 97d7c9f..c2d661b 100644 --- a/src/jalview/ws/dbsources/EmblXmlSource.java +++ b/src/jalview/ws/dbsources/EmblXmlSource.java @@ -20,6 +20,8 @@ */ package jalview.ws.dbsources; +import java.util.Locale; + import java.io.File; import java.io.FileInputStream; import java.io.InputStream; @@ -102,14 +104,14 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy try { reply = dbFetch.fetchDataAsFile( - emprefx.toLowerCase() + ":" + query.trim(), "display=xml", + emprefx.toLowerCase(Locale.ROOT) + ":" + query.trim(), "display=xml", "xml"); } catch (Exception e) { stopQuery(); throw new Exception( String.format("EBI EMBL XML retrieval failed for %s:%s", - emprefx.toLowerCase(), query.trim()), + emprefx.toLowerCase(Locale.ROOT), query.trim()), e); } return getEmblSequenceRecords(emprefx, query, reply); diff --git a/src/jalview/ws/dbsources/TDBeacons.java b/src/jalview/ws/dbsources/TDBeacons.java index b2fbc17..345e217 100644 --- a/src/jalview/ws/dbsources/TDBeacons.java +++ b/src/jalview/ws/dbsources/TDBeacons.java @@ -20,6 +20,8 @@ */ package jalview.ws.dbsources; +import java.util.Locale; + import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; @@ -142,7 +144,7 @@ public class TDBeacons extends DbSourceProxyImpl startQuery(); try { - queries = queries.toUpperCase().replaceAll( + queries = queries.toUpperCase(Locale.ROOT).replaceAll( "(UNIPROT\\|?|UNIPROT_|UNIREF\\d+_|UNIREF\\d+\\|?)", ""); AlignmentI al = null; diff --git a/src/jalview/ws/dbsources/Uniprot.java b/src/jalview/ws/dbsources/Uniprot.java index 2fc5893..a80a530 100644 --- a/src/jalview/ws/dbsources/Uniprot.java +++ b/src/jalview/ws/dbsources/Uniprot.java @@ -20,6 +20,8 @@ */ package jalview.ws.dbsources; +import java.util.Locale; + import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; @@ -139,7 +141,7 @@ public class Uniprot extends DbSourceProxyImpl startQuery(); try { - queries = queries.toUpperCase().replaceAll( + queries = queries.toUpperCase(Locale.ROOT).replaceAll( "(UNIPROT\\|?|UNIPROT_|UNIREF\\d+_|UNIREF\\d+\\|?)", ""); AlignmentI al = null; diff --git a/src/jalview/ws/dbsources/Xfam.java b/src/jalview/ws/dbsources/Xfam.java index f0cb14b..9340f65 100644 --- a/src/jalview/ws/dbsources/Xfam.java +++ b/src/jalview/ws/dbsources/Xfam.java @@ -20,6 +20,8 @@ */ package jalview.ws.dbsources; +import java.util.Locale; + import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; @@ -75,11 +77,11 @@ public abstract class Xfam extends DbSourceProxyImpl { rcds.getSequenceAt(s).addDBRef(new DBRefEntry(getXfamSource(), // getDbSource(), - getDbVersion(), queries.trim().toUpperCase())); + getDbVersion(), queries.trim().toUpperCase(Locale.ROOT))); if (!getDbSource().equals(getXfamSource())) { // add the specific ref too rcds.getSequenceAt(s).addDBRef(new DBRefEntry(getDbSource(), - getDbVersion(), queries.trim().toUpperCase())); + getDbVersion(), queries.trim().toUpperCase(Locale.ROOT))); } } stopQuery(); @@ -88,7 +90,7 @@ public abstract class Xfam extends DbSourceProxyImpl String getURL(String queries) { - return getURLPrefix() + "/family/" + queries.trim().toUpperCase() + return getURLPrefix() + "/family/" + queries.trim().toUpperCase(Locale.ROOT) + getURLSuffix(); } diff --git a/src/jalview/ws/ebi/EBIFetchClient.java b/src/jalview/ws/ebi/EBIFetchClient.java index b773d4e..1d04351 100644 --- a/src/jalview/ws/ebi/EBIFetchClient.java +++ b/src/jalview/ws/ebi/EBIFetchClient.java @@ -20,6 +20,8 @@ */ package jalview.ws.ebi; +import java.util.Locale; + import jalview.datamodel.DBRefSource; import jalview.util.MessageManager; import jalview.util.Platform; @@ -280,12 +282,12 @@ public class EBIFetchClient || database.equalsIgnoreCase(DBRefSource.EMBLCDS)) { url = "https://www.ebi.ac.uk/ena/browser/api/embl/" - + ids.toLowerCase() + "?download=true&gzip=true"; + + ids.toLowerCase(Locale.ROOT) + "?download=true&gzip=true"; } else { url = "https://www.ebi.ac.uk/Tools/dbfetch/dbfetch/" - + database.toLowerCase() + "/" + ids.toLowerCase() + + database.toLowerCase(Locale.ROOT) + "/" + ids.toLowerCase(Locale.ROOT) + (format != null ? "/" + format : ""); } return url; diff --git a/src/jalview/ws/io/mime/MimeTypes.java b/src/jalview/ws/io/mime/MimeTypes.java index 83252d8..7e6e660 100644 --- a/src/jalview/ws/io/mime/MimeTypes.java +++ b/src/jalview/ws/io/mime/MimeTypes.java @@ -20,6 +20,8 @@ */ package jalview.ws.io.mime; +import java.util.Locale; + import jalview.io.packed.DataProvider.JvDataType; /** @@ -53,7 +55,7 @@ public class MimeTypes */ public static JvDataType getTypeOf(String mimeType) { - String mt = mimeType.toLowerCase(); + String mt = mimeType.toLowerCase(Locale.ROOT); for (int i = 0; i < typemap.length; i += 2) { if (typemap[i].equals(mt)) diff --git a/src/jalview/ws/jws1/JPredClient.java b/src/jalview/ws/jws1/JPredClient.java index 3b7bdb6..e9c2aea 100644 --- a/src/jalview/ws/jws1/JPredClient.java +++ b/src/jalview/ws/jws1/JPredClient.java @@ -20,6 +20,8 @@ */ package jalview.ws.jws1; +import java.util.Locale; + import jalview.analysis.AlignSeq; import jalview.bin.Cache; import jalview.datamodel.AlignmentView; @@ -183,7 +185,7 @@ public class JPredClient extends WS1Client private String getPredictionName(String webServiceName) { - if (webServiceName.toLowerCase() + if (webServiceName.toLowerCase(Locale.ROOT) .indexOf("secondary structure prediction") > -1) { return webServiceName; diff --git a/src/jalview/ws/jws1/MsaWSClient.java b/src/jalview/ws/jws1/MsaWSClient.java index 4a09625..dad314b 100644 --- a/src/jalview/ws/jws1/MsaWSClient.java +++ b/src/jalview/ws/jws1/MsaWSClient.java @@ -20,6 +20,8 @@ */ package jalview.ws.jws1; +import java.util.Locale; + import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; import jalview.gui.AlignFrame; @@ -119,7 +121,7 @@ public class MsaWSClient extends WS1Client wsInfo.setProgressText(((submitGaps) ? "Re-alignment" : "Alignment") + " of " + altitle + "\nJob details\n"); - String jobtitle = WebServiceName.toLowerCase(); + String jobtitle = WebServiceName.toLowerCase(Locale.ROOT); if (jobtitle.endsWith("alignment")) { if (submitGaps && (!jobtitle.endsWith("realignment") diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index e33b4bd..8ed4a36 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -20,6 +20,8 @@ */ package jalview.ws.jws2; +import java.util.Locale; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -148,7 +150,7 @@ public class MsaWSClient extends Jws2Client wsInfo.setProgressText(((submitGaps) ? "Re-alignment" : "Alignment") + " of " + altitle + "\nJob details\n"); - String jobtitle = WebServiceName.toLowerCase(); + String jobtitle = WebServiceName.toLowerCase(Locale.ROOT); if (jobtitle.endsWith("alignment")) { if (submitGaps && (!jobtitle.endsWith("realignment") diff --git a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java index 45bddac..a30a09c 100644 --- a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java +++ b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java @@ -20,6 +20,8 @@ */ package jalview.ws.jws2; +import java.util.Locale; + import jalview.api.AlignCalcWorkerI; import jalview.gui.AlignFrame; import jalview.gui.Desktop; @@ -128,7 +130,7 @@ public class SequenceAnnotationWSClient extends Jws2Client worker.updateParameters(this.preset, paramset); } } - if (sh.action.toLowerCase().contains("disorder")) + if (sh.action.toLowerCase(Locale.ROOT).contains("disorder")) { // build IUPred style client. take sequences, returns annotation per // sequence. diff --git a/src/jalview/ws/rest/InputType.java b/src/jalview/ws/rest/InputType.java index 88431a6..a96b6d9 100644 --- a/src/jalview/ws/rest/InputType.java +++ b/src/jalview/ws/rest/InputType.java @@ -20,6 +20,8 @@ */ package jalview.ws.rest; +import java.util.Locale; + import jalview.ws.params.ArgumentI; import jalview.ws.params.InvalidArgumentException; import jalview.ws.params.OptionI; @@ -232,7 +234,7 @@ public abstract class InputType { valid = false; warnings.append("Invalid value for parameter " - + mtch.group(1).toLowerCase() + " '" + mtch.group(2) + + mtch.group(1).toLowerCase(Locale.ROOT) + " '" + mtch.group(2) + "' (expected an integer)\n"); } diff --git a/src/jalview/ws/rest/RestJobThread.java b/src/jalview/ws/rest/RestJobThread.java index acb7904..20b517b 100644 --- a/src/jalview/ws/rest/RestJobThread.java +++ b/src/jalview/ws/rest/RestJobThread.java @@ -20,6 +20,8 @@ */ package jalview.ws.rest; +import java.util.Locale; + import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; @@ -401,7 +403,7 @@ public class RestJobThread extends AWSThread */ String f; StringBuffer content = new StringBuffer(f = EntityUtils.toString(en)); - f = f.toLowerCase(); + f = f.toLowerCase(Locale.ROOT); int body = f.indexOf(" -1) { diff --git a/src/jalview/ws/sifts/SiftsClient.java b/src/jalview/ws/sifts/SiftsClient.java index ae58082..5a03aea 100644 --- a/src/jalview/ws/sifts/SiftsClient.java +++ b/src/jalview/ws/sifts/SiftsClient.java @@ -20,6 +20,8 @@ */ package jalview.ws.sifts; +import java.util.Locale; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -219,7 +221,7 @@ public class SiftsClient implements SiftsClientI } String siftsFileName = SiftsSettings.getSiftDownloadDirectory() - + pdbId.toLowerCase() + ".xml.gz"; + + pdbId.toLowerCase(Locale.ROOT) + ".xml.gz"; File siftsFile = new File(siftsFileName); if (siftsFile.exists()) { @@ -233,7 +235,7 @@ public class SiftsClient implements SiftsClientI BackupFiles.moveFileToFile(siftsFile, oldSiftsFile); try { - siftsFile = downloadSiftsFile(pdbId.toLowerCase()); + siftsFile = downloadSiftsFile(pdbId.toLowerCase(Locale.ROOT)); oldSiftsFile.delete(); return siftsFile; } catch (IOException e) @@ -250,7 +252,7 @@ public class SiftsClient implements SiftsClientI } try { - siftsFile = downloadSiftsFile(pdbId.toLowerCase()); + siftsFile = downloadSiftsFile(pdbId.toLowerCase(Locale.ROOT)); } catch (IOException e) { throw new SiftsException(e.getMessage()); @@ -356,7 +358,7 @@ public class SiftsClient implements SiftsClientI public static boolean deleteSiftsFileByPDBId(String pdbId) { File siftsFile = new File(SiftsSettings.getSiftDownloadDirectory() - + pdbId.toLowerCase() + ".xml.gz"); + + pdbId.toLowerCase(Locale.ROOT) + ".xml.gz"); if (siftsFile.exists()) { return siftsFile.delete(); @@ -431,7 +433,7 @@ public class SiftsClient implements SiftsClientI for (MapRegion mapRegion : mapRegions) { accessions - .add(mapRegion.getDb().getDbAccessionId().toLowerCase()); + .add(mapRegion.getDb().getDbAccessionId().toLowerCase(Locale.ROOT)); } } } @@ -501,9 +503,9 @@ public class SiftsClient implements SiftsClientI HashSet dbRefAccessionIdsString = new HashSet(); for (DBRefEntry dbref : seq.getDBRefs()) { - dbRefAccessionIdsString.add(dbref.getAccessionId().toLowerCase()); + dbRefAccessionIdsString.add(dbref.getAccessionId().toLowerCase(Locale.ROOT)); } - dbRefAccessionIdsString.add(sourceDBRef.getAccessionId().toLowerCase()); + dbRefAccessionIdsString.add(sourceDBRef.getAccessionId().toLowerCase(Locale.ROOT)); curDBRefAccessionIdsString = dbRefAccessionIdsString; curSourceDBRef = sourceDBRef.getAccessionId(); @@ -891,14 +893,14 @@ public class SiftsClient implements SiftsClientI { boolean isStrictMatch = true; return isStrictMatch ? curSourceDBRef.equalsIgnoreCase(accession) - : curDBRefAccessionIdsString.contains(accession.toLowerCase()); + : curDBRefAccessionIdsString.contains(accession.toLowerCase(Locale.ROOT)); } private boolean isFoundInSiftsEntry(String accessionId) { Set siftsDBRefs = getAllMappingAccession(); return accessionId != null - && siftsDBRefs.contains(accessionId.toLowerCase()); + && siftsDBRefs.contains(accessionId.toLowerCase(Locale.ROOT)); } /** diff --git a/test/jalview/analysis/AlignmentGenerator.java b/test/jalview/analysis/AlignmentGenerator.java index 9d3877c..d01b23e 100644 --- a/test/jalview/analysis/AlignmentGenerator.java +++ b/test/jalview/analysis/AlignmentGenerator.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.Sequence; @@ -91,7 +93,7 @@ public class AlignmentGenerator ps = new PrintStream(new File(args[6])); } - boolean nucleotide = args[0].toLowerCase().startsWith("n"); + boolean nucleotide = args[0].toLowerCase(Locale.ROOT).startsWith("n"); int width = Integer.parseInt(args[1]); int height = Integer.parseInt(args[2]); long randomSeed = Long.valueOf(args[3]); diff --git a/test/jalview/analysis/RnaTest.java b/test/jalview/analysis/RnaTest.java index 1faf3f2..cc35976 100644 --- a/test/jalview/analysis/RnaTest.java +++ b/test/jalview/analysis/RnaTest.java @@ -20,6 +20,8 @@ */ package jalview.analysis; +import java.util.Locale; + import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertNull; @@ -182,7 +184,7 @@ public class RnaTest char second = bases.charAt(j); boolean result = Rna.isCanonicalOrWobblePair(first, second); String pair = new String(new char[] { first, second }) - .toUpperCase(); + .toUpperCase(Locale.ROOT); if (pair.equals("AT") || pair.equals("TA") || pair.equals("AU") || pair.equals("UA") || pair.equals("GC") || pair.equals("CG") || pair.equals("GT") @@ -211,7 +213,7 @@ public class RnaTest char second = bases.charAt(j); boolean result = Rna.isCanonicalPair(first, second); String pair = new String(new char[] { first, second }) - .toUpperCase(); + .toUpperCase(Locale.ROOT); if (pair.equals("AT") || pair.equals("TA") || pair.equals("AU") || pair.equals("UA") || pair.equals("GC") || pair.equals("CG")) diff --git a/test/jalview/commands/EditCommandTest.java b/test/jalview/commands/EditCommandTest.java index 348d871..91f844e 100644 --- a/test/jalview/commands/EditCommandTest.java +++ b/test/jalview/commands/EditCommandTest.java @@ -20,6 +20,8 @@ */ package jalview.commands; +import java.util.Locale; + import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; @@ -286,7 +288,7 @@ public class EditCommandTest assertEquals("abcdefghjk", seqs[0].getSequenceAsString()); assertEquals("fghjZ-xYopq", seqs[1].getSequenceAsString()); // Dataset Sequence should always be uppercase - assertEquals("fghjZxYopq".toUpperCase(), + assertEquals("fghjZxYopq".toUpperCase(Locale.ROOT), seqs[1].getDatasetSequence().getSequenceAsString()); assertEquals("qrstuvwxyz", seqs[2].getSequenceAsString()); assertEquals("1234567890", seqs[3].getSequenceAsString()); @@ -317,7 +319,7 @@ public class EditCommandTest assertEquals(1, seq.getStart()); assertEquals(8, seq.getEnd()); // Dataset sequence always uppercase - assertEquals("ABxyZDEF".toUpperCase(), + assertEquals("ABxyZDEF".toUpperCase(Locale.ROOT), seq.getDatasetSequence().getSequenceAsString()); assertEquals(8, seq.getDatasetSequence().getEnd()); @@ -343,7 +345,7 @@ public class EditCommandTest assertEquals(1, seq.getStart()); assertEquals(8, seq.getEnd()); // dataset sequence should be Uppercase - assertEquals("ABxyZDEF".toUpperCase(), + assertEquals("ABxyZDEF".toUpperCase(Locale.ROOT), seq.getDatasetSequence().getSequenceAsString()); assertEquals(8, seq.getDatasetSequence().getEnd()); @@ -367,7 +369,7 @@ public class EditCommandTest // and ds is preserved assertTrue(dsseq == seqs[1].getDatasetSequence()); // and it is unchanged and UPPERCASE ! - assertEquals("fghjklmnopq".toUpperCase(), dsseq.getSequenceAsString()); + assertEquals("fghjklmnopq".toUpperCase(Locale.ROOT), dsseq.getSequenceAsString()); // and that alignment sequence start has been adjusted assertEquals(5, seqs[1].getStart()); assertEquals(11, seqs[1].getEnd()); @@ -394,7 +396,7 @@ public class EditCommandTest // and ds is preserved assertTrue(dsseq == seqs[1].getDatasetSequence()); // and it is unchanged AND UPPERCASE ! - assertEquals("fghjklmnopq".toUpperCase(), dsseq.getSequenceAsString()); + assertEquals("fghjklmnopq".toUpperCase(Locale.ROOT), dsseq.getSequenceAsString()); // and that alignment sequence start has been adjusted assertEquals(5, seqs[1].getStart()); assertEquals(11, seqs[1].getEnd()); diff --git a/test/jalview/datamodel/ResidueCountTest.java b/test/jalview/datamodel/ResidueCountTest.java index e90e1a9..a6e7429 100644 --- a/test/jalview/datamodel/ResidueCountTest.java +++ b/test/jalview/datamodel/ResidueCountTest.java @@ -20,6 +20,8 @@ */ package jalview.datamodel; +import java.util.Locale; + import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; @@ -181,7 +183,7 @@ public class ResidueCountTest ResidueCount rc = new ResidueCount(false); // expected characters (upper or lower case): String aas = "ACDEFGHIKLMNPQRSTVWXY"; - String lower = aas.toLowerCase(); + String lower = aas.toLowerCase(Locale.ROOT); for (int i = 0; i < aas.length(); i++) { rc.put(aas.charAt(i), i); @@ -206,7 +208,7 @@ public class ResidueCountTest ResidueCount rc = new ResidueCount(true); // expected characters (upper or lower case): String nucs = "ACGTUN"; - String lower = nucs.toLowerCase(); + String lower = nucs.toLowerCase(Locale.ROOT); for (int i = 0; i < nucs.length(); i++) { rc.put(nucs.charAt(i), i); diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index 5069759..2b44261 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -20,6 +20,8 @@ */ package jalview.datamodel; +import java.util.Locale; + import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertNotNull; @@ -812,7 +814,7 @@ public class SequenceTest } catch (IllegalArgumentException e) { // TODO Jalview error/exception class for raising implementation errors - assertTrue(e.getMessage().toLowerCase() + assertTrue(e.getMessage().toLowerCase(Locale.ROOT) .contains("implementation error")); } assertTrue(sq.getSequenceFeatures().isEmpty()); diff --git a/test/jalview/ext/ensembl/EnsemblCdnaTest.java b/test/jalview/ext/ensembl/EnsemblCdnaTest.java index 9e9d9a4..c927f04 100644 --- a/test/jalview/ext/ensembl/EnsemblCdnaTest.java +++ b/test/jalview/ext/ensembl/EnsemblCdnaTest.java @@ -20,6 +20,8 @@ */ package jalview.ext.ensembl; +import java.util.Locale; + import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertNull; @@ -230,7 +232,7 @@ public class EnsemblCdnaTest assertTrue(testee.retainFeature(sf, accId)); // test is not case-sensitive - assertTrue(testee.retainFeature(sf, accId.toLowerCase())); + assertTrue(testee.retainFeature(sf, accId.toLowerCase(Locale.ROOT))); // feature with wrong parent is not retained sf.setValue("Parent", "XYZ"); diff --git a/test/jalview/ext/ensembl/EnsemblGeneTest.java b/test/jalview/ext/ensembl/EnsemblGeneTest.java index ef12ed4..e16197a 100644 --- a/test/jalview/ext/ensembl/EnsemblGeneTest.java +++ b/test/jalview/ext/ensembl/EnsemblGeneTest.java @@ -20,6 +20,8 @@ */ package jalview.ext.ensembl; +import java.util.Locale; + import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertTrue; @@ -161,7 +163,7 @@ public class EnsemblGeneTest SequenceFeature sf3 = new SequenceFeature("NMD_transcript_variant", "", 22000, 22500, 0f, null); // id matching should not be case-sensitive - sf3.setValue("Parent", geneId.toLowerCase()); + sf3.setValue("Parent", geneId.toLowerCase(Locale.ROOT)); sf3.setValue("id", "transcript3"); genomic.addSequenceFeature(sf3); diff --git a/test/jalview/ext/paradise/TestAnnotate3D.java b/test/jalview/ext/paradise/TestAnnotate3D.java index 7d0916b..80fffff 100644 --- a/test/jalview/ext/paradise/TestAnnotate3D.java +++ b/test/jalview/ext/paradise/TestAnnotate3D.java @@ -20,6 +20,8 @@ */ package jalview.ext.paradise; +import java.util.Locale; + import static org.testng.AssertJUnit.assertTrue; import jalview.datamodel.AlignmentI; @@ -151,11 +153,11 @@ public class TestAnnotate3D { { SequenceI struseq = null; - String sq_ = sq.getSequenceAsString().toLowerCase(); + String sq_ = sq.getSequenceAsString().toLowerCase(Locale.ROOT); for (SequenceI _struseq : pdbf.getSeqsAsArray()) { final String lowerCase = _struseq.getSequenceAsString() - .toLowerCase(); + .toLowerCase(Locale.ROOT); if (lowerCase.equals(sq_)) { struseq = _struseq; diff --git a/test/jalview/io/FileFormatsTest.java b/test/jalview/io/FileFormatsTest.java index bf01fb7..3d25bf1 100644 --- a/test/jalview/io/FileFormatsTest.java +++ b/test/jalview/io/FileFormatsTest.java @@ -1,5 +1,7 @@ package jalview.io; +import java.util.Locale; + import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotEquals; @@ -103,8 +105,8 @@ public class FileFormatsTest for (FileFormatI ff : FileFormat.values()) { assertSame(ff, formats.forName(ff.getName())); - assertSame(ff, formats.forName(ff.getName().toUpperCase())); - assertSame(ff, formats.forName(ff.getName().toLowerCase())); + assertSame(ff, formats.forName(ff.getName().toUpperCase(Locale.ROOT))); + assertSame(ff, formats.forName(ff.getName().toLowerCase(Locale.ROOT))); } assertNull(formats.forName(null)); assertNull(formats.forName("rubbish")); diff --git a/test/jalview/ws/gui/Jws2ParamView.java b/test/jalview/ws/gui/Jws2ParamView.java index 80b48c3..2318971 100644 --- a/test/jalview/ws/gui/Jws2ParamView.java +++ b/test/jalview/ws/gui/Jws2ParamView.java @@ -20,6 +20,8 @@ */ package jalview.ws.gui; +import java.util.Locale; + import jalview.bin.Cache; import jalview.gui.JvOptionPane; import jalview.gui.WsJobParameters; @@ -66,7 +68,7 @@ public class Jws2ParamView public static List presetTests = new ArrayList(); static { - serviceTests.add("AAConWS".toLowerCase()); + serviceTests.add("AAConWS".toLowerCase(Locale.ROOT)); } public static Jws2Discoverer disc = null; @@ -91,7 +93,7 @@ public class Jws2ParamView for (Jws2Instance service : disc.getServices()) { if (serviceTests.size() == 0 - || serviceTests.contains(service.serviceType.toLowerCase())) + || serviceTests.contains(service.serviceType.toLowerCase(Locale.ROOT))) { List prl = null; Preset pr = null; diff --git a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java index e8b6c2b..d13dc0f 100644 --- a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java +++ b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java @@ -20,6 +20,8 @@ */ package jalview.ws.jabaws; +import java.util.Locale; + import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; @@ -85,7 +87,7 @@ public class DisorderAnnotExportImport iupreds = new ArrayList(); for (Jws2Instance svc : disc.getServices()) { - if (svc.getServiceTypeURI().toLowerCase().contains("iupredws")) + if (svc.getServiceTypeURI().toLowerCase(Locale.ROOT).contains("iupredws")) { iupreds.add(svc); } diff --git a/test/jalview/ws/jabaws/RNAStructExportImport.java b/test/jalview/ws/jabaws/RNAStructExportImport.java index 889c003..cc9aba0 100644 --- a/test/jalview/ws/jabaws/RNAStructExportImport.java +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@ -20,6 +20,8 @@ */ package jalview.ws.jabaws; +import java.util.Locale; + import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; @@ -98,7 +100,7 @@ public class RNAStructExportImport for (Jws2Instance svc : disc.getServices()) { - if (svc.getServiceTypeURI().toLowerCase().contains("rnaalifoldws")) + if (svc.getServiceTypeURI().toLowerCase(Locale.ROOT).contains("rnaalifoldws")) { rnaalifoldws = svc; } diff --git a/test/jalview/ws/jws2/ParameterUtilsTest.java b/test/jalview/ws/jws2/ParameterUtilsTest.java index c0aa2ee..51ff19c 100644 --- a/test/jalview/ws/jws2/ParameterUtilsTest.java +++ b/test/jalview/ws/jws2/ParameterUtilsTest.java @@ -20,6 +20,8 @@ */ package jalview.ws.jws2; +import java.util.Locale; + import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertTrue; @@ -68,7 +70,7 @@ public class ParameterUtilsTest @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { - serviceTests.add("AAConWS".toLowerCase()); + serviceTests.add("AAConWS".toLowerCase(Locale.ROOT)); Cache.loadProperties("test/jalview/io/testProps.jvprops"); Cache.initLogger(); disc = JalviewJabawsTestUtils.getJabawsDiscoverer(); @@ -131,7 +133,7 @@ public class ParameterUtilsTest public boolean isForTesting(Jws2Instance service) { return serviceTests.size() == 0 - || serviceTests.contains(service.serviceType.toLowerCase()); + || serviceTests.contains(service.serviceType.toLowerCase(Locale.ROOT)); } @Test(groups = { "Network" }) diff --git a/test/junit/extensions/PrivilegedAccessor.java b/test/junit/extensions/PrivilegedAccessor.java index 23f1c6e..c5c0f04 100644 --- a/test/junit/extensions/PrivilegedAccessor.java +++ b/test/junit/extensions/PrivilegedAccessor.java @@ -15,6 +15,8 @@ */ package junit.extensions; +import java.util.Locale; + import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -432,7 +434,7 @@ final class PrivilegedAccessor { return false; } - if (className.startsWith(className.substring(0, 1).toUpperCase())) + if (className.startsWith(className.substring(0, 1).toUpperCase(Locale.ROOT))) { return true; } -- 1.7.10.2