diff options
| author | 2025-09-03 13:59:45 +0300 | |
|---|---|---|
| committer | 2025-09-03 11:59:45 +0100 | |
| commit | 57c37c222c43f732c8b7703263cf9a573561322f (patch) | |
| tree | b1eda877bac461463448ec1def988810447193fc /enigma-cli | |
| parent | Update Gradle and fix buildscripts (#557) (diff) | |
| download | enigma-fork-57c37c222c43f732c8b7703263cf9a573561322f.tar.gz enigma-fork-57c37c222c43f732c8b7703263cf9a573561322f.tar.xz enigma-fork-57c37c222c43f732c8b7703263cf9a573561322f.zip | |
Always specify locale in toUpperCase and toLowerCase (#556)
Not all of these changes are strictly needed to avoid the Turkish i issue
specifically, but it's good to be consistent.
Diffstat (limited to 'enigma-cli')
| -rw-r--r-- | enigma-cli/src/main/java/cuchaz/enigma/command/Command.java | 3 | ||||
| -rw-r--r-- | enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java b/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java index 06c4916..53b277f 100644 --- a/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java +++ b/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java | |||
| @@ -5,6 +5,7 @@ import java.io.IOException; | |||
| 5 | import java.nio.file.Files; | 5 | import java.nio.file.Files; |
| 6 | import java.nio.file.Path; | 6 | import java.nio.file.Path; |
| 7 | import java.nio.file.Paths; | 7 | import java.nio.file.Paths; |
| 8 | import java.util.Locale; | ||
| 8 | 9 | ||
| 9 | import net.fabricmc.mappingio.MappingReader; | 10 | import net.fabricmc.mappingio.MappingReader; |
| 10 | import net.fabricmc.mappingio.tree.MemoryMappingTree; | 11 | import net.fabricmc.mappingio.tree.MemoryMappingTree; |
| @@ -56,7 +57,7 @@ public abstract class Command { | |||
| 56 | 57 | ||
| 57 | protected static EntryTree<EntryMapping> readMappings(Path path, ProgressListener progress, MappingSaveParameters saveParameters) throws IOException, MappingParseException { | 58 | protected static EntryTree<EntryMapping> readMappings(Path path, ProgressListener progress, MappingSaveParameters saveParameters) throws IOException, MappingParseException { |
| 58 | // Legacy | 59 | // Legacy |
| 59 | if (path.getFileName().toString().toLowerCase().endsWith(".zip")) { | 60 | if (path.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".zip")) { |
| 60 | return MappingFormat.ENIGMA_ZIP.read(path, progress, saveParameters, null); | 61 | return MappingFormat.ENIGMA_ZIP.read(path, progress, saveParameters, null); |
| 61 | } | 62 | } |
| 62 | 63 | ||
diff --git a/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java b/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java index e1e216a..7c6bf43 100644 --- a/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java +++ b/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java | |||
| @@ -4,6 +4,7 @@ import java.io.IOException; | |||
| 4 | import java.io.UncheckedIOException; | 4 | import java.io.UncheckedIOException; |
| 5 | import java.nio.file.Files; | 5 | import java.nio.file.Files; |
| 6 | import java.nio.file.Path; | 6 | import java.nio.file.Path; |
| 7 | import java.util.Locale; | ||
| 7 | 8 | ||
| 8 | import net.fabricmc.mappingio.MappingWriter; | 9 | import net.fabricmc.mappingio.MappingWriter; |
| 9 | import net.fabricmc.mappingio.tree.VisitableMappingTree; | 10 | import net.fabricmc.mappingio.tree.VisitableMappingTree; |
| @@ -34,7 +35,7 @@ public final class MappingCommandsUtil { | |||
| 34 | MappingFormat format = null; | 35 | MappingFormat format = null; |
| 35 | 36 | ||
| 36 | try { | 37 | try { |
| 37 | format = MappingFormat.valueOf(type.toUpperCase()); | 38 | format = MappingFormat.valueOf(type.toUpperCase(Locale.ROOT)); |
| 38 | } catch (IllegalArgumentException ignored) { | 39 | } catch (IllegalArgumentException ignored) { |
| 39 | if (type.equals("tinyv2")) { | 40 | if (type.equals("tinyv2")) { |
| 40 | format = MappingFormat.TINY_V2; | 41 | format = MappingFormat.TINY_V2; |
| @@ -101,7 +102,7 @@ public final class MappingCommandsUtil { | |||
| 101 | MappingFormat format = null; | 102 | MappingFormat format = null; |
| 102 | 103 | ||
| 103 | try { | 104 | try { |
| 104 | format = MappingFormat.valueOf(type.toUpperCase()); | 105 | format = MappingFormat.valueOf(type.toUpperCase(Locale.ROOT)); |
| 105 | } catch (IllegalArgumentException ignored) { | 106 | } catch (IllegalArgumentException ignored) { |
| 106 | // ignored | 107 | // ignored |
| 107 | } | 108 | } |