Call String.toLowerCase and .toUppercase with explicit locale
Closes gh-42719
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.boot.loader.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
@@ -88,7 +89,7 @@ public abstract class FileUtils {
|
||||
}
|
||||
|
||||
private static boolean isDigestName(Object name) {
|
||||
return String.valueOf(name).toUpperCase().endsWith("-DIGEST");
|
||||
return String.valueOf(name).toUpperCase(Locale.ROOT).endsWith("-DIGEST");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.boot.loader.tools;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
@@ -41,7 +42,7 @@ public class Layer {
|
||||
public Layer(String name) {
|
||||
Assert.hasText(name, "Name must not be empty");
|
||||
Assert.isTrue(PATTERN.matcher(name).matches(), () -> "Malformed layer name '" + name + "'");
|
||||
Assert.isTrue(!name.equalsIgnoreCase("ext") && !name.toLowerCase().startsWith("springboot"),
|
||||
Assert.isTrue(!name.equalsIgnoreCase("ext") && !name.toLowerCase(Locale.ROOT).startsWith("springboot"),
|
||||
() -> "Layer name '" + name + "' is reserved");
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.boot.loader.tools;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class Repackager extends Packager {
|
||||
@Override
|
||||
protected void writeSignatureFileIfNecessary(Map<String, Library> writtenLibraries, AbstractJarWriter writer)
|
||||
throws IOException {
|
||||
if (getSource().getName().toLowerCase().endsWith(".jar") && hasSignedLibrary(writtenLibraries)) {
|
||||
if (getSource().getName().toLowerCase(Locale.ROOT).endsWith(".jar") && hasSignedLibrary(writtenLibraries)) {
|
||||
writer.writeEntry("META-INF/BOOT.SF", (entryWriter) -> {
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user