Skip to content

[java] Feat 14291/add jspecify annotations to exception classes pt4 #16028

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 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions java/src/org/openqa/selenium/devtools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ java_library(
deps = [
"//java/src/org/openqa/selenium:core",
"//java/src/org/openqa/selenium/json",
"@maven//:org_jspecify_jspecify",
],
)

Expand Down Expand Up @@ -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",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {}
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.openqa.selenium.remote;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import org.openqa.selenium.WebDriverException;

/**
Expand All @@ -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);
}
}
1 change: 1 addition & 0 deletions java/src/org/openqa/selenium/remote/http/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}