Skip to content

Commit 63eca90

Browse files
iampopovichpujaganiVietND96
authored
[java] Feat 14291/add jspecify annotations to exception classes pt4 (#16028)
Co-authored-by: Puja Jagani <[email protected]> Co-authored-by: Viet Nguyen Duc <[email protected]>
1 parent fc28c02 commit 63eca90

File tree

9 files changed

+31
-10
lines changed

9 files changed

+31
-10
lines changed

java/src/org/openqa/selenium/devtools/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ java_library(
2222
deps = [
2323
"//java/src/org/openqa/selenium:core",
2424
"//java/src/org/openqa/selenium/json",
25+
"@maven//:org_jspecify_jspecify",
2526
],
2627
)
2728

@@ -75,6 +76,7 @@ java_library(
7576
"//java/src/org/openqa/selenium:core",
7677
"//java/src/org/openqa/selenium/json",
7778
"//java/src/org/openqa/selenium/remote/http",
79+
"@maven//:org_jspecify_jspecify",
7880
],
7981
)
8082

java/src/org/openqa/selenium/devtools/RequestFailedException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.openqa.selenium.devtools;
1919

20+
import org.jspecify.annotations.NullMarked;
2021
import org.openqa.selenium.WebDriverException;
2122
import org.openqa.selenium.remote.http.Filter;
2223
import org.openqa.selenium.remote.http.HttpHandler;
@@ -26,4 +27,5 @@
2627
* browser fails to send a HTTP request. It can be caught in a {@link Filter} to handle the error
2728
* by, for example, returning a custom HTTP response.
2829
*/
30+
@NullMarked
2931
public class RequestFailedException extends WebDriverException {}

java/src/org/openqa/selenium/grid/sessionmap/jdbc/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ java_export(
2121
"//java/src/org/openqa/selenium/grid",
2222
"//java/src/org/openqa/selenium/json",
2323
"//java/src/org/openqa/selenium/remote",
24+
"@maven//:org_jspecify_jspecify",
2425
artifact("com.beust:jcommander"),
2526
artifact("com.google.guava:guava"),
2627
],

java/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcException.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,25 @@
1717

1818
package org.openqa.selenium.grid.sessionmap.jdbc;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
2022
import org.openqa.selenium.WebDriverException;
2123

24+
@NullMarked
2225
public class JdbcException extends WebDriverException {
2326
public JdbcException() {
2427
super();
2528
}
2629

27-
public JdbcException(String message) {
30+
public JdbcException(@Nullable String message) {
2831
super(message);
2932
}
3033

31-
public JdbcException(Throwable cause) {
34+
public JdbcException(@Nullable Throwable cause) {
3235
super(cause);
3336
}
3437

35-
public JdbcException(String message, Throwable cause) {
38+
public JdbcException(@Nullable String message, @Nullable Throwable cause) {
3639
super(message, cause);
3740
}
3841
}

java/src/org/openqa/selenium/remote/NoSuchDriverException.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,22 @@
1717

1818
package org.openqa.selenium.remote;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
2022
import org.openqa.selenium.WebDriverException;
2123
import org.openqa.selenium.remote.service.DriverFinder;
2224

2325
/** Thrown by {@link DriverFinder#getDriverPath()} (DriverService, Capabilities)}. */
26+
@NullMarked
2427
public class NoSuchDriverException extends WebDriverException {
2528

2629
private static final String SUPPORT_URL = BASE_SUPPORT_URL + "/driver_location/";
2730

28-
public NoSuchDriverException(String reason) {
31+
public NoSuchDriverException(@Nullable String reason) {
2932
super(reason);
3033
}
3134

32-
public NoSuchDriverException(String reason, Throwable cause) {
35+
public NoSuchDriverException(@Nullable String reason, @Nullable Throwable cause) {
3336
super(reason, cause);
3437
}
3538

java/src/org/openqa/selenium/remote/UnreachableBrowserException.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.openqa.selenium.remote;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
2022
import org.openqa.selenium.WebDriverException;
2123

2224
/**
@@ -33,12 +35,13 @@
3335
*
3436
* 1)
3537
*/
38+
@NullMarked
3639
public class UnreachableBrowserException extends WebDriverException {
37-
public UnreachableBrowserException(String message) {
40+
public UnreachableBrowserException(@Nullable String message) {
3841
super(message);
3942
}
4043

41-
public UnreachableBrowserException(String message, Throwable cause) {
44+
public UnreachableBrowserException(@Nullable String message, @Nullable Throwable cause) {
4245
super(message, cause);
4346
}
4447
}

java/src/org/openqa/selenium/remote/http/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ java_export(
1919
"//java:auto-service",
2020
"//java/src/org/openqa/selenium:core",
2121
"//java/src/org/openqa/selenium/json",
22+
"@maven//:org_jspecify_jspecify",
2223
],
2324
)

java/src/org/openqa/selenium/remote/http/ConnectionFailedException.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@
1717

1818
package org.openqa.selenium.remote.http;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
2022
import org.openqa.selenium.WebDriverException;
2123

24+
@NullMarked
2225
public class ConnectionFailedException extends WebDriverException {
2326

24-
public ConnectionFailedException(String message) {
27+
public ConnectionFailedException(@Nullable String message) {
2528
super(message);
2629
}
2730

28-
public ConnectionFailedException(String message, Throwable cause) {
31+
public ConnectionFailedException(@Nullable String message, @Nullable Throwable cause) {
2932
super(message, cause);
3033
}
3134
}

java/src/org/openqa/selenium/safari/ConnectionClosedException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@
1717

1818
package org.openqa.selenium.safari;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
2022
import org.openqa.selenium.WebDriverException;
2123

2224
/** Exception thrown when the connection to the SafariDriver is lost. */
25+
@NullMarked
2326
public class ConnectionClosedException extends WebDriverException {
2427

25-
public ConnectionClosedException(String message) {
28+
public ConnectionClosedException(@Nullable String message) {
2629
super(message);
2730
}
2831
}

0 commit comments

Comments
 (0)