diff --git a/java/src/org/openqa/selenium/bidi/network/FetchError.java b/java/src/org/openqa/selenium/bidi/network/FetchError.java index 3f5361d4f5c99..e0010e0e24c7d 100644 --- a/java/src/org/openqa/selenium/bidi/network/FetchError.java +++ b/java/src/org/openqa/selenium/bidi/network/FetchError.java @@ -41,7 +41,7 @@ private FetchError(BaseParameters baseParameters, String errorText) { public static FetchError fromJsonMap(Map jsonMap) { try (StringReader baseParameterReader = new StringReader(JSON.toJson(jsonMap)); - JsonInput baseParamsInput = JSON.newInput(baseParameterReader); ) { + JsonInput baseParamsInput = JSON.newInput(baseParameterReader)) { String errorText = JSON.toJson(jsonMap.get("errorText")); return new FetchError(BaseParameters.fromJson(baseParamsInput), errorText); } diff --git a/java/src/org/openqa/selenium/bidi/script/EvaluateResult.java b/java/src/org/openqa/selenium/bidi/script/EvaluateResult.java index 6b06e0bfc60cc..c6c975a281d10 100644 --- a/java/src/org/openqa/selenium/bidi/script/EvaluateResult.java +++ b/java/src/org/openqa/selenium/bidi/script/EvaluateResult.java @@ -22,7 +22,7 @@ public interface EvaluateResult { String getRealmId(); - public enum Type { + enum Type { SUCCESS("success"), EXCEPTION("exception"); diff --git a/java/src/org/openqa/selenium/bidi/script/SerializationOptions.java b/java/src/org/openqa/selenium/bidi/script/SerializationOptions.java index e51131d7b537b..264ca37630af2 100644 --- a/java/src/org/openqa/selenium/bidi/script/SerializationOptions.java +++ b/java/src/org/openqa/selenium/bidi/script/SerializationOptions.java @@ -26,7 +26,7 @@ public class SerializationOptions { public enum IncludeShadowTree { NONE, OPEN, - ALL; + ALL } private Optional maxDomDepth = Optional.empty(); diff --git a/java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java b/java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java index 8fd841e3188bd..3e3278c4fcfec 100644 --- a/java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java +++ b/java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java @@ -316,25 +316,25 @@ public boolean isReady() { private String uriKey(SessionId id) { Require.nonNull("Session ID", id); - return "session:" + id.toString() + ":uri"; + return "session:" + id + ":uri"; } private String capabilitiesKey(SessionId id) { Require.nonNull("Session ID", id); - return "session:" + id.toString() + ":capabilities"; + return "session:" + id + ":capabilities"; } private String startKey(SessionId id) { Require.nonNull("Session ID", id); - return "session:" + id.toString() + ":start"; + return "session:" + id + ":start"; } private String stereotypeKey(SessionId id) { Require.nonNull("Session ID", id); - return "session:" + id.toString() + ":stereotype"; + return "session:" + id + ":stereotype"; } private void setCommonSpanAttributes(Span span) { diff --git a/java/src/org/openqa/selenium/json/JsonInput.java b/java/src/org/openqa/selenium/json/JsonInput.java index 2122410e4643d..5c8842851a3e0 100644 --- a/java/src/org/openqa/selenium/json/JsonInput.java +++ b/java/src/org/openqa/selenium/json/JsonInput.java @@ -246,7 +246,7 @@ public Number nextNumber() { } return number.longValue(); } catch (NumberFormatException e) { - throw new JsonException("Unable to parse to a number: " + builder.toString() + ". " + input); + throw new JsonException("Unable to parse to a number: " + builder + ". " + input); } } diff --git a/java/src/org/openqa/selenium/remote/ErrorCodec.java b/java/src/org/openqa/selenium/remote/ErrorCodec.java index 957c5a1f91eb3..e4fbbaddfbcaa 100644 --- a/java/src/org/openqa/selenium/remote/ErrorCodec.java +++ b/java/src/org/openqa/selenium/remote/ErrorCodec.java @@ -144,12 +144,12 @@ public int getHttpStatusCode(Throwable throwable) { public WebDriverException decode(Map response) { if (!(response.get("value") instanceof Map)) { - throw new IllegalArgumentException("Unable to find mapping for " + response.toString()); + throw new IllegalArgumentException("Unable to find mapping for " + response); } Map value = (Map) response.get("value"); if (!(value.get("error") instanceof String)) { - throw new IllegalArgumentException("Unable to find mapping for " + response.toString()); + throw new IllegalArgumentException("Unable to find mapping for " + response); } String error = (String) value.get("error"); diff --git a/java/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java b/java/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java index a4eea99d0dbeb..59375fc2fc0d5 100644 --- a/java/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java +++ b/java/src/org/openqa/selenium/support/pagefactory/internal/LocatingElementHandler.java @@ -38,7 +38,7 @@ public Object invoke(Object object, Method method, Object[] objects) throws Thro element = locator.findElement(); } catch (NoSuchElementException e) { if ("toString".equals(method.getName())) { - return "Proxy element for: " + locator.toString(); + return "Proxy element for: " + locator; } throw e; } diff --git a/java/test/org/openqa/selenium/ProxySettingTest.java b/java/test/org/openqa/selenium/ProxySettingTest.java index 3b3fb4b1ccb90..d3da50ec06243 100644 --- a/java/test/org/openqa/selenium/ProxySettingTest.java +++ b/java/test/org/openqa/selenium/ProxySettingTest.java @@ -94,7 +94,7 @@ public void canConfigureProxyThroughPACFile() throws URISyntaxException, Interru .join( "function FindProxyForURL(url, host) {", " return 'PROXY " + getHostAndPort(helloServer) + "';", - "}")); ) { + "}"))) { Proxy proxy = new Proxy(); proxy.setProxyAutoconfigUrl("http://" + getHostAndPort(pacFileServer) + "/proxy.pac"); @@ -132,7 +132,7 @@ public void canUsePACThatOnlyProxiesCertainHosts() " return 'PROXY " + getHostAndPort(goodbyeServer) + "';", " }", " return 'DIRECT';", - "}")); ) { + "}"))) { Proxy proxy = new Proxy(); proxy.setProxyAutoconfigUrl("http://" + getHostAndPort(pacFileServer) + "/proxy.pac"); diff --git a/java/test/org/openqa/selenium/interactions/DragAndDropTest.java b/java/test/org/openqa/selenium/interactions/DragAndDropTest.java index b61d4aa5ef3db..16579a729e0db 100644 --- a/java/test/org/openqa/selenium/interactions/DragAndDropTest.java +++ b/java/test/org/openqa/selenium/interactions/DragAndDropTest.java @@ -43,7 +43,7 @@ private static void sleep(int ms) { try { Thread.sleep(ms); } catch (InterruptedException e) { - throw new RuntimeException("Interrupted: " + e.toString()); + throw new RuntimeException("Interrupted: " + e); } } diff --git a/java/test/org/openqa/selenium/javascript/TestFileLocator.java b/java/test/org/openqa/selenium/javascript/TestFileLocator.java index fb50faf97f382..3d66472c52927 100644 --- a/java/test/org/openqa/selenium/javascript/TestFileLocator.java +++ b/java/test/org/openqa/selenium/javascript/TestFileLocator.java @@ -101,7 +101,7 @@ public static String getTestFilePath(Path baseDir, Path testFile) { testFile .toAbsolutePath() .toString() - .replace(baseDir.toAbsolutePath().toString() + File.separator, "") + .replace(baseDir.toAbsolutePath() + File.separator, "") .replace(File.separator, "/"); if (path.endsWith(".js")) { path = "common/generated/" + path; diff --git a/java/test/org/openqa/selenium/json/JsonTest.java b/java/test/org/openqa/selenium/json/JsonTest.java index ad5e0c0ef1007..3c9be8c689b12 100644 --- a/java/test/org/openqa/selenium/json/JsonTest.java +++ b/java/test/org/openqa/selenium/json/JsonTest.java @@ -376,7 +376,7 @@ void shouldBeAbleToConvertASelenium3CommandToASelenium2Command() { // In selenium 2, the sessionId is an object. In selenium 3, it's a straight string. String raw = "{\"sessionId\": \"" - + expectedId.toString() + + expectedId + "\", " + "\"name\": \"some command\"," + "\"parameters\": {}}";