Merge pull request #49816 from quaff

* patch-209:
  Do not use String#replaceAll() with a non-regex pattern

Closes gh-49816
This commit is contained in:
Stéphane Nicoll
2026-03-27 11:44:23 +01:00
6 changed files with 6 additions and 6 deletions
@@ -92,7 +92,7 @@ final class PemCertificateParser {
}
private static byte[] decodeBase64(String content) {
byte[] bytes = content.replaceAll("\r", "").replaceAll("\n", "").getBytes();
byte[] bytes = content.replace("\r", "").replace("\n", "").getBytes();
return Base64.getDecoder().decode(bytes);
}
@@ -240,7 +240,7 @@ final class PemPrivateKeyParser {
}
private static byte[] decodeBase64(String content) {
byte[] contentBytes = content.replaceAll("\r", "").replaceAll("\n", "").getBytes();
byte[] contentBytes = content.replace("\r", "").replace("\n", "").getBytes();
return Base64.getDecoder().decode(contentBytes);
}
@@ -482,7 +482,7 @@ class LifecycleTests {
return (invocation) -> {
ContainerConfig config = invocation.getArgument(0, ContainerConfig.class);
ArrayNode command = getCommand(config);
String name = command.get(0).asText().substring(1).replaceAll("/", "-");
String name = command.get(0).asText().substring(1).replace('/', '-');
this.configs.put(name, config);
if (invocation.getArguments().length > 2) {
this.content.put(name, invocation.getArgument(2, ContainerContent.class));
@@ -181,7 +181,7 @@ public class PemFileWriter {
Path writeFile(String name, String... contents) throws IOException {
Path path = Paths.get(this.tempDir.toString(), name);
for (String content : contents) {
Files.write(path, content.replaceAll(EXAMPLE_SECRET_QUALIFIER, "").getBytes(), StandardOpenOption.CREATE,
Files.write(path, content.replace(EXAMPLE_SECRET_QUALIFIER, "").getBytes(), StandardOpenOption.CREATE,
StandardOpenOption.APPEND);
}
return path;
@@ -92,7 +92,7 @@ final class PemCertificateParser {
}
private static byte[] decodeBase64(String content) {
byte[] bytes = content.replaceAll("\r", "").replaceAll("\n", "").getBytes();
byte[] bytes = content.replace("\r", "").replace("\n", "").getBytes();
return Base64.getDecoder().decode(bytes);
}
@@ -240,7 +240,7 @@ final class PemPrivateKeyParser {
}
private static byte[] decodeBase64(String content) {
byte[] contentBytes = content.replaceAll("\r", "").replaceAll("\n", "").getBytes();
byte[] contentBytes = content.replace("\r", "").replace("\n", "").getBytes();
return Base64.getDecoder().decode(contentBytes);
}