32
32
import java .util .List ;
33
33
import java .util .Locale ;
34
34
import java .util .Map ;
35
+ import org .jspecify .annotations .Nullable ;
35
36
import org .openqa .selenium .Capabilities ;
36
37
import org .openqa .selenium .WebDriverException ;
37
38
import org .openqa .selenium .net .PortProber ;
@@ -83,11 +84,11 @@ public class GeckoDriverService extends FirefoxDriverService {
83
84
* @throws IOException If an I/O error occurs.
84
85
*/
85
86
public GeckoDriverService (
86
- File executable ,
87
+ @ Nullable File executable ,
87
88
int port ,
88
- Duration timeout ,
89
- List <String > args ,
90
- Map <String , String > environment )
89
+ @ Nullable Duration timeout ,
90
+ @ Nullable List <String > args ,
91
+ @ Nullable Map <String , String > environment )
91
92
throws IOException {
92
93
super (
93
94
executable ,
@@ -142,10 +143,10 @@ protected boolean hasShutdownEndpoint() {
142
143
public static class Builder
143
144
extends FirefoxDriverService .Builder <GeckoDriverService , GeckoDriverService .Builder > {
144
145
145
- private String allowHosts ;
146
- private FirefoxDriverLogLevel logLevel ;
147
- private Boolean logTruncate ;
148
- private File profileRoot ;
146
+ private @ Nullable String allowHosts ;
147
+ private @ Nullable FirefoxDriverLogLevel logLevel ;
148
+ private @ Nullable Boolean logTruncate ;
149
+ private @ Nullable File profileRoot ;
149
150
150
151
@ Override
151
152
public int score (Capabilities capabilities ) {
@@ -168,7 +169,7 @@ public int score(Capabilities capabilities) {
168
169
* @param allowHosts Space-separated list of host names.
169
170
* @return A self reference.
170
171
*/
171
- public Builder withAllowHosts (String allowHosts ) {
172
+ public Builder withAllowHosts (@ Nullable String allowHosts ) {
172
173
this .allowHosts = allowHosts ;
173
174
return this ;
174
175
}
@@ -177,7 +178,7 @@ public Builder withAllowHosts(String allowHosts) {
177
178
* @param logLevel which log events to record.
178
179
* @return A self reference.
179
180
*/
180
- public Builder withLogLevel (FirefoxDriverLogLevel logLevel ) {
181
+ public Builder withLogLevel (@ Nullable FirefoxDriverLogLevel logLevel ) {
181
182
this .logLevel = logLevel ;
182
183
return this ;
183
184
}
@@ -187,7 +188,7 @@ public Builder withLogLevel(FirefoxDriverLogLevel logLevel) {
187
188
* default; setting "false" removes truncation
188
189
* @return A self reference.
189
190
*/
190
- public Builder withTruncatedLogs (Boolean truncate ) {
191
+ public Builder withTruncatedLogs (@ Nullable Boolean truncate ) {
191
192
this .logTruncate = truncate ;
192
193
return this ;
193
194
}
@@ -198,7 +199,7 @@ public Builder withTruncatedLogs(Boolean truncate) {
198
199
* @param root location to store temporary profiles Defaults to the system temporary directory.
199
200
* @return A self reference.
200
201
*/
201
- public GeckoDriverService .Builder withProfileRoot (File root ) {
202
+ public GeckoDriverService .Builder withProfileRoot (@ Nullable File root ) {
202
203
this .profileRoot = root ;
203
204
return this ;
204
205
}
@@ -257,7 +258,11 @@ protected List<String> createArgs() {
257
258
258
259
@ Override
259
260
protected GeckoDriverService createDriverService (
260
- File exe , int port , Duration timeout , List <String > args , Map <String , String > environment ) {
261
+ @ Nullable File exe ,
262
+ int port ,
263
+ @ Nullable Duration timeout ,
264
+ @ Nullable List <String > args ,
265
+ @ Nullable Map <String , String > environment ) {
261
266
try {
262
267
return new GeckoDriverService (exe , port , timeout , args , environment );
263
268
} catch (IOException e ) {
0 commit comments