diff --git a/java/src/dev/selenium/tools/modules/ModuleGenerator.java b/java/src/dev/selenium/tools/modules/ModuleGenerator.java index 4fb1091482f7b..99c00b0632abd 100644 --- a/java/src/dev/selenium/tools/modules/ModuleGenerator.java +++ b/java/src/dev/selenium/tools/modules/ModuleGenerator.java @@ -53,6 +53,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; +import java.nio.charset.StandardCharsets; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; @@ -213,11 +214,9 @@ public static void main(String[] args) throws IOException { } if (result != 0) { throw new RuntimeException( - "Unable to process module:\n" - + "jdeps " - + String.join(" ", jdepsArgs) - + "\n" - + new String(bos.toByteArray())); + String.format( + "Unable to process module:%njdeps %s%n%s", + String.join(" ", jdepsArgs), bos.toString(StandardCharsets.UTF_8))); } AtomicReference moduleInfo = new AtomicReference<>(); diff --git a/java/src/org/openqa/selenium/Platform.java b/java/src/org/openqa/selenium/Platform.java index 927989c0bfd97..ff7e2a1266603 100644 --- a/java/src/org/openqa/selenium/Platform.java +++ b/java/src/org/openqa/selenium/Platform.java @@ -447,7 +447,7 @@ public static Platform extractFromSysProperty(String osName, String osVersion) { String previousMatch = null; for (Platform os : Platform.values()) { for (String matcher : os.partOfOsName) { - if ("".equals(matcher)) { + if (matcher.isEmpty()) { continue; } matcher = matcher.toLowerCase(Locale.ENGLISH); diff --git a/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java b/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java index a5b1aab9ea087..1ecd16b369c28 100644 --- a/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java +++ b/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java @@ -242,7 +242,7 @@ public HttpRequest encode(Command command) { byte[] data = content.getBytes(UTF_8); request.setHeader(HttpHeader.ContentLength.getName(), String.valueOf(data.length)); - request.setHeader(HttpHeader.ContentType.getName(), JSON_UTF_8.toString()); + request.setHeader(HttpHeader.ContentType.getName(), JSON_UTF_8); request.setContent(bytes(data)); }