Skip to content

Commit 1b4be8b

Browse files
authored
Merge branch 'trunk' into py-network-continue_response-and-data-collectors
2 parents b90621d + c88ea44 commit 1b4be8b

22 files changed

+81
-66
lines changed

.bazelrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ test --test_env=FIREFOX_NIGHTLY_BINARY
8787
test --test_env=GITHUB_ACTIONS
8888
test --test_env=MOZ_HEADLESS
8989
test --test_env=SELENIUM_BROWSER
90-
test --test_env=TRAVIS
9190
test --test_env=PYTHON_VERSION
9291
test --test_env=SE_AVOID_STATS=true
9392

java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementAccount.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package org.openqa.selenium.federatedcredentialmanagement;
1919

2020
import java.util.Map;
21+
import org.jspecify.annotations.NullMarked;
22+
import org.jspecify.annotations.Nullable;
2123

2224
/**
2325
* Represents an account displayed in a FedCM account list.
@@ -27,29 +29,30 @@
2729
* @see <a href="https://w3c-fedid.github.io/FedCM/#webdriver-accountlist">
2830
* https://w3c-fedid.github.io/FedCM/#webdriver-accountlist</a>
2931
*/
32+
@NullMarked
3033
public class FederatedCredentialManagementAccount {
31-
private final String accountId;
32-
private final String email;
33-
private final String name;
34-
private final String givenName;
35-
private final String pictureUrl;
34+
private final @Nullable String accountId;
35+
private final @Nullable String email;
36+
private final @Nullable String name;
37+
private final @Nullable String givenName;
38+
private final @Nullable String pictureUrl;
3639

3740
/**
3841
* The config URL of the identity provider that provided this account.
3942
*
4043
* <p>This allows identifying the IDP in multi-IDP cases.
4144
*/
42-
private final String idpConfigUrl;
45+
private final @Nullable String idpConfigUrl;
4346

4447
/**
4548
* The login state for this account.
4649
*
4750
* <p>One of LOGIN_STATE_SIGNIN and LOGIN_STATE_SIGNUP.
4851
*/
49-
private final String loginState;
52+
private final @Nullable String loginState;
5053

51-
private final String termsOfServiceUrl;
52-
private final String privacyPolicyUrl;
54+
private final @Nullable String termsOfServiceUrl;
55+
private final @Nullable String privacyPolicyUrl;
5356

5457
public static final String LOGIN_STATE_SIGNIN = "SignIn";
5558
public static final String LOGIN_STATE_SIGNUP = "SignUp";
@@ -66,39 +69,39 @@ public FederatedCredentialManagementAccount(Map<String, String> dict) {
6669
privacyPolicyUrl = (String) dict.getOrDefault("privacyPolicyUrl", null);
6770
}
6871

69-
public String getAccountid() {
72+
public @Nullable String getAccountid() {
7073
return accountId;
7174
}
7275

73-
public String getEmail() {
76+
public @Nullable String getEmail() {
7477
return email;
7578
}
7679

77-
public String getName() {
80+
public @Nullable String getName() {
7881
return name;
7982
}
8083

81-
public String getGivenName() {
84+
public @Nullable String getGivenName() {
8285
return givenName;
8386
}
8487

85-
public String getPictureUrl() {
88+
public @Nullable String getPictureUrl() {
8689
return pictureUrl;
8790
}
8891

89-
public String getIdpConfigUrl() {
92+
public @Nullable String getIdpConfigUrl() {
9093
return idpConfigUrl;
9194
}
9295

93-
public String getLoginState() {
96+
public @Nullable String getLoginState() {
9497
return loginState;
9598
}
9699

97-
public String getTermsOfServiceUrl() {
100+
public @Nullable String getTermsOfServiceUrl() {
98101
return termsOfServiceUrl;
99102
}
100103

101-
public String getPrivacyPolicyUrl() {
104+
public @Nullable String getPrivacyPolicyUrl() {
102105
return privacyPolicyUrl;
103106
}
104107
}

java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementDialog.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818
package org.openqa.selenium.federatedcredentialmanagement;
1919

2020
import java.util.List;
21+
import org.jspecify.annotations.NullMarked;
22+
import org.jspecify.annotations.Nullable;
2123

2224
/**
2325
* Represents an open dialog of the Federated Credential Management API.
2426
*
2527
* @see <a href="https://w3c-fedid.github.io/FedCM/">https://w3c-fedid.github.io/FedCM/</a>
2628
*/
29+
@NullMarked
2730
public interface FederatedCredentialManagementDialog {
2831

2932
String DIALOG_TYPE_ACCOUNT_LIST = "AccountChooser";
@@ -44,13 +47,13 @@ public interface FederatedCredentialManagementDialog {
4447
*
4548
* <p>One of DIALOG_TYPE_ACCOUNT_LIST and DIALOG_TYPE_AUTO_REAUTH.
4649
*/
47-
String getDialogType();
50+
@Nullable String getDialogType();
4851

4952
/** Returns the title of the dialog. */
50-
String getTitle();
53+
@Nullable String getTitle();
5154

5255
/** Returns the subtitle of the dialog or null if none. */
53-
String getSubtitle();
56+
@Nullable String getSubtitle();
5457

5558
void clickDialog();
5659

java/src/org/openqa/selenium/federatedcredentialmanagement/HasFederatedCredentialManagement.java

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

1818
package org.openqa.selenium.federatedcredentialmanagement;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
2022
import org.openqa.selenium.Beta;
2123

2224
/** Used by classes to indicate that they can interact with FedCM dialogs. */
2325
@Beta
26+
@NullMarked
2427
public interface HasFederatedCredentialManagement {
2528
/**
2629
* Disables the promise rejection delay.
@@ -45,5 +48,5 @@ public interface HasFederatedCredentialManagement {
4548
* <p>Can be used with WebDriverWait like: wait.until(driver ->
4649
* ((HasFederatedCredentialManagement) driver). getFederatedCredentialManagementDialog() != null);
4750
*/
48-
FederatedCredentialManagementDialog getFederatedCredentialManagementDialog();
51+
@Nullable FederatedCredentialManagementDialog getFederatedCredentialManagementDialog();
4952
}

java/src/org/openqa/selenium/interactions/CompositeAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919

2020
import java.util.ArrayList;
2121
import java.util.List;
22+
import org.jspecify.annotations.NullMarked;
2223
import org.openqa.selenium.internal.Require;
2324

2425
/** An action for aggregating actions and triggering all of them at the same time. */
26+
@NullMarked
2527
public class CompositeAction implements Action {
2628

2729
private final List<Action> actionsList = new ArrayList<>();

java/src/org/openqa/selenium/interactions/Interaction.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717

1818
package org.openqa.selenium.interactions;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
2022
/**
2123
* Used as the basis of {@link Sequence}s for the W3C WebDriver spec <a
2224
* href="https://www.w3.org/TR/webdriver/#actions">Action commands</a>.
2325
*/
26+
@NullMarked
2427
public abstract class Interaction {
2528

2629
private final InputSource source;

java/src/org/openqa/selenium/interactions/Locatable.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
package org.openqa.selenium.interactions;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
22+
@NullMarked
2023
public interface Locatable {
2124
Coordinates getCoordinates();
2225
}

java/src/org/openqa/selenium/interactions/MoveTargetOutOfBoundsException.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.interactions;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
import org.jspecify.annotations.Nullable;
2022
import org.openqa.selenium.WebDriverException;
2123

2224
/**
2325
* Indicates that the target provided to the actions move() method is invalid - outside of the size
2426
* of the window.
2527
*/
28+
@NullMarked
2629
public class MoveTargetOutOfBoundsException extends WebDriverException {
27-
public MoveTargetOutOfBoundsException(String message) {
30+
public MoveTargetOutOfBoundsException(@Nullable String message) {
2831
super(message);
2932
}
3033

31-
public MoveTargetOutOfBoundsException(Throwable cause) {
34+
public MoveTargetOutOfBoundsException(@Nullable Throwable cause) {
3235
super(cause);
3336
}
3437

35-
public MoveTargetOutOfBoundsException(String message, Throwable cause) {
38+
public MoveTargetOutOfBoundsException(@Nullable String message, @Nullable Throwable cause) {
3639
super(message, cause);
3740
}
3841
}

java/src/org/openqa/selenium/net/LinuxEphemeralPortRangeDetector.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
import java.io.UncheckedIOException;
2626
import java.nio.charset.Charset;
2727
import java.nio.file.Files;
28+
import org.jspecify.annotations.NullMarked;
2829

30+
@NullMarked
2931
public class LinuxEphemeralPortRangeDetector implements EphemeralPortRangeDetector {
3032

3133
private final int firstEphemeralPort;

java/src/org/openqa/selenium/net/NetworkUtils.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@
2828
import java.util.List;
2929
import java.util.Objects;
3030
import java.util.concurrent.TimeUnit;
31+
import org.jspecify.annotations.NullMarked;
32+
import org.jspecify.annotations.Nullable;
3133
import org.openqa.selenium.Platform;
3234
import org.openqa.selenium.WebDriverException;
35+
import org.openqa.selenium.internal.Require;
3336

37+
@NullMarked
3438
public class NetworkUtils {
3539

36-
private static InetAddress cachedIp4NonLoopbackAddressOfThisMachine;
37-
private static String cachedIp4NonLoopbackAddressHostName;
40+
private static @Nullable InetAddress cachedIp4NonLoopbackAddressOfThisMachine;
41+
private static @Nullable String cachedIp4NonLoopbackAddressHostName;
3842

3943
private final NetworkInterfaceProvider networkInterfaceProvider;
40-
private volatile String hostname;
41-
private volatile String address;
44+
private volatile @Nullable String hostname;
45+
private volatile @Nullable String address;
4246

4347
NetworkUtils(NetworkInterfaceProvider networkInterfaceProvider) {
4448
this.networkInterfaceProvider = networkInterfaceProvider;
@@ -56,13 +60,13 @@ public NetworkUtils() {
5660
public String getHostname() {
5761
determineHostnameAndAddress();
5862

59-
return hostname;
63+
return Require.nonNull("Hostname", hostname);
6064
}
6165

6266
public String getHostAddress() {
6367
determineHostnameAndAddress();
6468

65-
return address;
69+
return Require.nonNull("Address", address);
6670
}
6771

6872
public String getPrivateLocalAddress() {
@@ -81,7 +85,7 @@ public String getPrivateLocalAddress() {
8185
*
8286
* @return A String representing the host name or non-loopback IP4 address of this machine.
8387
*/
84-
public String getNonLoopbackAddressOfThisMachine() {
88+
public @Nullable String getNonLoopbackAddressOfThisMachine() {
8589
InetAddress ip4NonLoopbackAddressOfThisMachine = getIp4NonLoopbackAddressOfThisMachine();
8690
if (!Objects.equals(
8791
cachedIp4NonLoopbackAddressOfThisMachine, ip4NonLoopbackAddressOfThisMachine)) {
@@ -113,10 +117,13 @@ public InetAddress getIp4NonLoopbackAddressOfThisMachine() {
113117
*
114118
* @return The address part og such an address
115119
*/
116-
public String obtainLoopbackIp4Address() {
120+
public @Nullable String obtainLoopbackIp4Address() {
117121
final NetworkInterface networkInterface = getLoopBackAndIp4Only();
118122
if (networkInterface != null) {
119-
return networkInterface.getIp4LoopbackOnly().getHostName();
123+
InetAddress loopback = networkInterface.getIp4LoopbackOnly();
124+
if (loopback != null) {
125+
return loopback.getHostName();
126+
}
120127
}
121128

122129
final String ipOfIp4LoopBack = getIpOfLoopBackIp4();
@@ -156,7 +163,7 @@ private InetAddress grabFirstNetworkAddress() {
156163
return firstAddress;
157164
}
158165

159-
public String getIpOfLoopBackIp4() {
166+
public @Nullable String getIpOfLoopBackIp4() {
160167
for (NetworkInterface iface : networkInterfaceProvider.getNetworkInterfaces()) {
161168
final InetAddress netAddress = iface.getIp4LoopbackOnly();
162169
if (netAddress != null) {
@@ -166,7 +173,7 @@ public String getIpOfLoopBackIp4() {
166173
return null;
167174
}
168175

169-
private NetworkInterface getLoopBackAndIp4Only() {
176+
private @Nullable NetworkInterface getLoopBackAndIp4Only() {
170177
for (NetworkInterface iface : networkInterfaceProvider.getNetworkInterfaces()) {
171178
if (iface.isIp4AddressBindingOnly() && iface.isLoopBack()) {
172179
return iface;

0 commit comments

Comments
 (0)