Skip to content

[java] simplify strings processing #15309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: trunk
Choose a base branch
from
9 changes: 4 additions & 5 deletions java/src/dev/selenium/tools/modules/ModuleGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -212,11 +213,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<Path> moduleInfo = new AtomicReference<>();
Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Loading