Skip to content

Commit 19a275e

Browse files
committed
Add JSpecify nullable annotations to exception classes
1 parent 6c607a8 commit 19a275e

File tree

7 files changed

+32
-11
lines changed

7 files changed

+32
-11
lines changed

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/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/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
}

java/src/org/openqa/selenium/support/ui/UnexpectedTagNameException.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717

1818
package org.openqa.selenium.support.ui;
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 UnexpectedTagNameException extends WebDriverException {
23-
public UnexpectedTagNameException(String expectedTagName, String actualTagName) {
26+
public UnexpectedTagNameException(
27+
@Nullable String expectedTagName, @Nullable String actualTagName) {
2428
super(
2529
String.format(
2630
"Element should have been \"%s\" but was \"%s\"", expectedTagName, actualTagName));

0 commit comments

Comments
 (0)