3232import java .util .List ;
3333import java .util .Locale ;
3434import java .util .Map ;
35+ import org .jspecify .annotations .Nullable ;
3536import org .openqa .selenium .Capabilities ;
3637import org .openqa .selenium .WebDriverException ;
3738import org .openqa .selenium .net .PortProber ;
@@ -83,11 +84,11 @@ public class GeckoDriverService extends FirefoxDriverService {
8384 * @throws IOException If an I/O error occurs.
8485 */
8586 public GeckoDriverService (
86- File executable ,
87+ @ Nullable File executable ,
8788 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 )
9192 throws IOException {
9293 super (
9394 executable ,
@@ -142,10 +143,10 @@ protected boolean hasShutdownEndpoint() {
142143 public static class Builder
143144 extends FirefoxDriverService .Builder <GeckoDriverService , GeckoDriverService .Builder > {
144145
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 ;
149150
150151 @ Override
151152 public int score (Capabilities capabilities ) {
@@ -168,7 +169,7 @@ public int score(Capabilities capabilities) {
168169 * @param allowHosts Space-separated list of host names.
169170 * @return A self reference.
170171 */
171- public Builder withAllowHosts (String allowHosts ) {
172+ public Builder withAllowHosts (@ Nullable String allowHosts ) {
172173 this .allowHosts = allowHosts ;
173174 return this ;
174175 }
@@ -177,7 +178,7 @@ public Builder withAllowHosts(String allowHosts) {
177178 * @param logLevel which log events to record.
178179 * @return A self reference.
179180 */
180- public Builder withLogLevel (FirefoxDriverLogLevel logLevel ) {
181+ public Builder withLogLevel (@ Nullable FirefoxDriverLogLevel logLevel ) {
181182 this .logLevel = logLevel ;
182183 return this ;
183184 }
@@ -187,7 +188,7 @@ public Builder withLogLevel(FirefoxDriverLogLevel logLevel) {
187188 * default; setting "false" removes truncation
188189 * @return A self reference.
189190 */
190- public Builder withTruncatedLogs (Boolean truncate ) {
191+ public Builder withTruncatedLogs (@ Nullable Boolean truncate ) {
191192 this .logTruncate = truncate ;
192193 return this ;
193194 }
@@ -198,7 +199,7 @@ public Builder withTruncatedLogs(Boolean truncate) {
198199 * @param root location to store temporary profiles Defaults to the system temporary directory.
199200 * @return A self reference.
200201 */
201- public GeckoDriverService .Builder withProfileRoot (File root ) {
202+ public GeckoDriverService .Builder withProfileRoot (@ Nullable File root ) {
202203 this .profileRoot = root ;
203204 return this ;
204205 }
@@ -257,7 +258,11 @@ protected List<String> createArgs() {
257258
258259 @ Override
259260 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 ) {
261266 try {
262267 return new GeckoDriverService (exe , port , timeout , args , environment );
263268 } catch (IOException e ) {
0 commit comments