mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 19:55:52 -07:00
SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package org.bukkit;
|
||||
import static org.bukkit.support.MatcherAssert.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -31,7 +32,7 @@ public class ColorTest {
|
||||
this.r = r;
|
||||
this.g = g;
|
||||
this.b = b;
|
||||
this.name = id + ":" + Integer.toHexString(argb).toUpperCase() + "_" + Integer.toHexString(rgb).toUpperCase() + "_" + Integer.toHexString(bgr).toUpperCase() + "-a" + Integer.toHexString(a).toUpperCase() + "-r" + Integer.toHexString(r).toUpperCase() + "-g" + Integer.toHexString(g).toUpperCase() + "-b" + Integer.toHexString(b).toUpperCase();
|
||||
this.name = id + ":" + Integer.toHexString(argb).toUpperCase(Locale.ROOT) + "_" + Integer.toHexString(rgb).toUpperCase(Locale.ROOT) + "_" + Integer.toHexString(bgr).toUpperCase(Locale.ROOT) + "-a" + Integer.toHexString(a).toUpperCase(Locale.ROOT) + "-r" + Integer.toHexString(r).toUpperCase(Locale.ROOT) + "-g" + Integer.toHexString(g).toUpperCase(Locale.ROOT) + "-b" + Integer.toHexString(b).toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,7 @@ package org.bukkit;
|
||||
import static org.bukkit.support.MatcherAssert.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -66,7 +67,7 @@ public class MaterialTest {
|
||||
@Test
|
||||
public void matchMaterialByLowerCaseAndSpaces() {
|
||||
for (Material material : Material.values()) {
|
||||
String name = material.toString().replaceAll("_", " ").toLowerCase(java.util.Locale.ENGLISH);
|
||||
String name = material.toString().replaceAll("_", " ").toLowerCase(Locale.ROOT);
|
||||
assertThat(Material.matchMaterial(name), is(material));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user