Skip to content
Merged
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
1 change: 1 addition & 0 deletions java/src/org/openqa/selenium/firefox/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ java_export(
"//java/src/org/openqa/selenium/json",
"//java/src/org/openqa/selenium/manager",
"//java/src/org/openqa/selenium/remote",
"@maven//:org_jspecify_jspecify",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.time.Duration;
import java.util.List;
import java.util.Map;
import org.jspecify.annotations.Nullable;
import org.openqa.selenium.remote.service.DriverService;

public abstract class FirefoxDriverService extends DriverService {
Expand All @@ -35,11 +36,11 @@ public abstract class FirefoxDriverService extends DriverService {
* @throws IOException If an I/O error occurs.
*/
public FirefoxDriverService(
File executable,
@Nullable File executable,
int port,
Duration timeout,
List<String> args,
Map<String, String> environment)
@Nullable Duration timeout,
@Nullable List<String> args,
@Nullable Map<String, String> environment)
throws IOException {
super(executable, port, timeout, args, environment);
}
Expand Down
31 changes: 18 additions & 13 deletions java/src/org/openqa/selenium/firefox/GeckoDriverService.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.jspecify.annotations.Nullable;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.net.PortProber;
Expand Down Expand Up @@ -83,11 +84,11 @@ public class GeckoDriverService extends FirefoxDriverService {
* @throws IOException If an I/O error occurs.
*/
public GeckoDriverService(
File executable,
@Nullable File executable,
int port,
Duration timeout,
List<String> args,
Map<String, String> environment)
@Nullable Duration timeout,
@Nullable List<String> args,
@Nullable Map<String, String> environment)
throws IOException {
super(
executable,
Expand Down Expand Up @@ -142,10 +143,10 @@ protected boolean hasShutdownEndpoint() {
public static class Builder
extends FirefoxDriverService.Builder<GeckoDriverService, GeckoDriverService.Builder> {

private String allowHosts;
private FirefoxDriverLogLevel logLevel;
private Boolean logTruncate;
private File profileRoot;
private @Nullable String allowHosts;
private @Nullable FirefoxDriverLogLevel logLevel;
private @Nullable Boolean logTruncate;
private @Nullable File profileRoot;

@Override
public int score(Capabilities capabilities) {
Expand All @@ -168,7 +169,7 @@ public int score(Capabilities capabilities) {
* @param allowHosts Space-separated list of host names.
* @return A self reference.
*/
public Builder withAllowHosts(String allowHosts) {
public Builder withAllowHosts(@Nullable String allowHosts) {
this.allowHosts = allowHosts;
return this;
}
Expand All @@ -177,7 +178,7 @@ public Builder withAllowHosts(String allowHosts) {
* @param logLevel which log events to record.
* @return A self reference.
*/
public Builder withLogLevel(FirefoxDriverLogLevel logLevel) {
public Builder withLogLevel(@Nullable FirefoxDriverLogLevel logLevel) {
this.logLevel = logLevel;
return this;
}
Expand All @@ -187,7 +188,7 @@ public Builder withLogLevel(FirefoxDriverLogLevel logLevel) {
* default; setting "false" removes truncation
* @return A self reference.
*/
public Builder withTruncatedLogs(Boolean truncate) {
public Builder withTruncatedLogs(@Nullable Boolean truncate) {
this.logTruncate = truncate;
return this;
}
Expand All @@ -198,7 +199,7 @@ public Builder withTruncatedLogs(Boolean truncate) {
* @param root location to store temporary profiles Defaults to the system temporary directory.
* @return A self reference.
*/
public GeckoDriverService.Builder withProfileRoot(File root) {
public GeckoDriverService.Builder withProfileRoot(@Nullable File root) {
this.profileRoot = root;
return this;
}
Expand Down Expand Up @@ -257,7 +258,11 @@ protected List<String> createArgs() {

@Override
protected GeckoDriverService createDriverService(
File exe, int port, Duration timeout, List<String> args, Map<String, String> environment) {
@Nullable File exe,
int port,
@Nullable Duration timeout,
@Nullable List<String> args,
@Nullable Map<String, String> environment) {
try {
return new GeckoDriverService(exe, port, timeout, args, environment);
} catch (IOException e) {
Expand Down