diff --git a/java/src/org/openqa/selenium/devtools/BUILD.bazel b/java/src/org/openqa/selenium/devtools/BUILD.bazel index 351d22c5781ba..e2aa19ae7e1f8 100644 --- a/java/src/org/openqa/selenium/devtools/BUILD.bazel +++ b/java/src/org/openqa/selenium/devtools/BUILD.bazel @@ -22,6 +22,7 @@ java_library( deps = [ "//java/src/org/openqa/selenium:core", "//java/src/org/openqa/selenium/json", + "@maven//:org_jspecify_jspecify", ], ) @@ -75,6 +76,7 @@ java_library( "//java/src/org/openqa/selenium:core", "//java/src/org/openqa/selenium/json", "//java/src/org/openqa/selenium/remote/http", + "@maven//:org_jspecify_jspecify", ], ) diff --git a/java/src/org/openqa/selenium/devtools/RequestFailedException.java b/java/src/org/openqa/selenium/devtools/RequestFailedException.java index 6ffef0c946fc3..322d610b28951 100644 --- a/java/src/org/openqa/selenium/devtools/RequestFailedException.java +++ b/java/src/org/openqa/selenium/devtools/RequestFailedException.java @@ -17,6 +17,7 @@ package org.openqa.selenium.devtools; +import org.jspecify.annotations.NullMarked; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.remote.http.Filter; import org.openqa.selenium.remote.http.HttpHandler; @@ -26,4 +27,5 @@ * browser fails to send a HTTP request. It can be caught in a {@link Filter} to handle the error * by, for example, returning a custom HTTP response. */ +@NullMarked public class RequestFailedException extends WebDriverException {} diff --git a/java/src/org/openqa/selenium/grid/sessionmap/jdbc/BUILD.bazel b/java/src/org/openqa/selenium/grid/sessionmap/jdbc/BUILD.bazel index c87659c3bb941..821a4e5d9b64e 100644 --- a/java/src/org/openqa/selenium/grid/sessionmap/jdbc/BUILD.bazel +++ b/java/src/org/openqa/selenium/grid/sessionmap/jdbc/BUILD.bazel @@ -21,6 +21,7 @@ java_export( "//java/src/org/openqa/selenium/grid", "//java/src/org/openqa/selenium/json", "//java/src/org/openqa/selenium/remote", + "@maven//:org_jspecify_jspecify", artifact("com.beust:jcommander"), artifact("com.google.guava:guava"), ], diff --git a/java/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcException.java b/java/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcException.java index 7b98a504bcc40..6cb0c694be40f 100644 --- a/java/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcException.java +++ b/java/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcException.java @@ -17,22 +17,25 @@ package org.openqa.selenium.grid.sessionmap.jdbc; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import org.openqa.selenium.WebDriverException; +@NullMarked public class JdbcException extends WebDriverException { public JdbcException() { super(); } - public JdbcException(String message) { + public JdbcException(@Nullable String message) { super(message); } - public JdbcException(Throwable cause) { + public JdbcException(@Nullable Throwable cause) { super(cause); } - public JdbcException(String message, Throwable cause) { + public JdbcException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } } diff --git a/java/src/org/openqa/selenium/remote/NoSuchDriverException.java b/java/src/org/openqa/selenium/remote/NoSuchDriverException.java index 359f2458b60b0..c3ad3ea114e00 100644 --- a/java/src/org/openqa/selenium/remote/NoSuchDriverException.java +++ b/java/src/org/openqa/selenium/remote/NoSuchDriverException.java @@ -17,19 +17,22 @@ package org.openqa.selenium.remote; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.remote.service.DriverFinder; /** Thrown by {@link DriverFinder#getDriverPath()} (DriverService, Capabilities)}. */ +@NullMarked public class NoSuchDriverException extends WebDriverException { private static final String SUPPORT_URL = BASE_SUPPORT_URL + "/driver_location/"; - public NoSuchDriverException(String reason) { + public NoSuchDriverException(@Nullable String reason) { super(reason); } - public NoSuchDriverException(String reason, Throwable cause) { + public NoSuchDriverException(@Nullable String reason, @Nullable Throwable cause) { super(reason, cause); } diff --git a/java/src/org/openqa/selenium/remote/UnreachableBrowserException.java b/java/src/org/openqa/selenium/remote/UnreachableBrowserException.java index 005edb47486a1..a86a83c0711ff 100644 --- a/java/src/org/openqa/selenium/remote/UnreachableBrowserException.java +++ b/java/src/org/openqa/selenium/remote/UnreachableBrowserException.java @@ -17,6 +17,8 @@ package org.openqa.selenium.remote; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import org.openqa.selenium.WebDriverException; /** @@ -33,12 +35,13 @@ * * 1) */ +@NullMarked public class UnreachableBrowserException extends WebDriverException { - public UnreachableBrowserException(String message) { + public UnreachableBrowserException(@Nullable String message) { super(message); } - public UnreachableBrowserException(String message, Throwable cause) { + public UnreachableBrowserException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } } diff --git a/java/src/org/openqa/selenium/remote/http/BUILD.bazel b/java/src/org/openqa/selenium/remote/http/BUILD.bazel index e3a780dbbbbec..128a2e2262988 100644 --- a/java/src/org/openqa/selenium/remote/http/BUILD.bazel +++ b/java/src/org/openqa/selenium/remote/http/BUILD.bazel @@ -19,5 +19,6 @@ java_export( "//java:auto-service", "//java/src/org/openqa/selenium:core", "//java/src/org/openqa/selenium/json", + "@maven//:org_jspecify_jspecify", ], ) diff --git a/java/src/org/openqa/selenium/remote/http/ConnectionFailedException.java b/java/src/org/openqa/selenium/remote/http/ConnectionFailedException.java index 696bc6705d42e..18730585e0c39 100644 --- a/java/src/org/openqa/selenium/remote/http/ConnectionFailedException.java +++ b/java/src/org/openqa/selenium/remote/http/ConnectionFailedException.java @@ -17,15 +17,18 @@ package org.openqa.selenium.remote.http; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import org.openqa.selenium.WebDriverException; +@NullMarked public class ConnectionFailedException extends WebDriverException { - public ConnectionFailedException(String message) { + public ConnectionFailedException(@Nullable String message) { super(message); } - public ConnectionFailedException(String message, Throwable cause) { + public ConnectionFailedException(@Nullable String message, @Nullable Throwable cause) { super(message, cause); } } diff --git a/java/src/org/openqa/selenium/safari/ConnectionClosedException.java b/java/src/org/openqa/selenium/safari/ConnectionClosedException.java index 2fda07c64c3c8..696b8696a3fb8 100644 --- a/java/src/org/openqa/selenium/safari/ConnectionClosedException.java +++ b/java/src/org/openqa/selenium/safari/ConnectionClosedException.java @@ -17,12 +17,15 @@ package org.openqa.selenium.safari; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import org.openqa.selenium.WebDriverException; /** Exception thrown when the connection to the SafariDriver is lost. */ +@NullMarked public class ConnectionClosedException extends WebDriverException { - public ConnectionClosedException(String message) { + public ConnectionClosedException(@Nullable String message) { super(message); } }