diff --git a/java/src/dev/selenium/tools/modules/ModuleGenerator.java b/java/src/dev/selenium/tools/modules/ModuleGenerator.java index 4fb1091482f7b..d11f2459ece38 100644 --- a/java/src/dev/selenium/tools/modules/ModuleGenerator.java +++ b/java/src/dev/selenium/tools/modules/ModuleGenerator.java @@ -60,6 +60,7 @@ import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; +import java.nio.file.charset.StandardCharsets; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -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 412d742fa079c..6182c4b2439c6 100644 --- a/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java +++ b/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java @@ -237,7 +237,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)); }