Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use toLower with a locale #1362

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion java/org/contikios/cooja/Cooja.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Properties;
import java.util.Random;
Expand Down Expand Up @@ -964,7 +965,7 @@ private static Properties getExternalToolsDefaultSettings() {

settings.put("PARSE_COMMAND", "nm -aP $(LIBFILE)");
settings.put("COMMAND_VAR_NAME_ADDRESS_SIZE", "^(?<symbol>[^.].*?) <SECTION> (?<address>[0-9a-fA-F]+) (?<size>[0-9a-fA-F])*");
String osName = System.getProperty("os.name").toLowerCase();
String osName = System.getProperty("os.name").toLowerCase(Locale.ROOT);
if (osName.startsWith("mac os x")) {
settings.put("PARSE_WITH_COMMAND", "true");
settings.put("PARSE_COMMAND", "symbols $(LIBFILE)");
Expand Down
3 changes: 2 additions & 1 deletion java/org/contikios/cooja/ui/ColorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

package org.contikios.cooja.ui;
import java.awt.Color;
import java.util.Locale;

/**
* Utility methods for managing colors.
Expand All @@ -50,7 +51,7 @@ private ColorUtils() {
* @see java.awt.Color#decode(String)
*/
public static Color decodeColor(String colorString) {
return colorString == null ? null : switch (colorString.toLowerCase()) {
return colorString == null ? null : switch (colorString.toLowerCase(Locale.ROOT)) {
case "black" -> Color.black;
case "blue" -> Color.blue;
case "cyan" -> Color.cyan;
Expand Down
3 changes: 2 additions & 1 deletion java/se/sics/mspsim/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Locale;
import se.sics.mspsim.chip.AT45DB;
import se.sics.mspsim.chip.M25P80;
import se.sics.mspsim.platform.GenericNode;
Expand Down Expand Up @@ -156,7 +157,7 @@ public static String getNodeTypeByPlatform(String platform) {
// Try to guess the node type.
default -> "se.sics.mspsim.platform." + platform + '.'
+ Character.toUpperCase(platform.charAt(0))
+ platform.substring(1).toLowerCase() + "Node";
+ platform.substring(1).toLowerCase(Locale.ROOT) + "Node";
};
}

Expand Down
3 changes: 2 additions & 1 deletion java/se/sics/mspsim/util/PluginRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Locale;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
Expand Down Expand Up @@ -111,7 +112,7 @@ private static class JarFilter implements FileFilter {
@Override
public boolean accept(File f) {
if (f.isFile() && f.canRead()) {
String name = f.getName().toLowerCase();
String name = f.getName().toLowerCase(Locale.ROOT);
return name.endsWith(".jar");
}
return false;
Expand Down