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
8 changes: 6 additions & 2 deletions java/src/org/openqa/selenium/html5/AppCacheStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@

package org.openqa.selenium.html5;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/** Represents the application cache status. */
@Deprecated
@NullMarked
public enum AppCacheStatus {
UNCACHED(0),
IDLE(1),
Expand All @@ -43,7 +47,7 @@ public int value() {
* @param value The input value
* @return {@link AppCacheStatus} The corresponding appcache status
*/
public static AppCacheStatus getEnum(int value) {
public static @Nullable AppCacheStatus getEnum(int value) {
for (AppCacheStatus status : AppCacheStatus.values()) {
if (value == status.value()) {
return status;
Expand All @@ -52,7 +56,7 @@ public static AppCacheStatus getEnum(int value) {
return null;
}

public static AppCacheStatus getEnum(String value) {
public static @Nullable AppCacheStatus getEnum(String value) {
for (AppCacheStatus status : AppCacheStatus.values()) {
if (status.toString().equalsIgnoreCase(value)) {
return status;
Expand Down
9 changes: 6 additions & 3 deletions java/src/org/openqa/selenium/internal/Either.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Stream;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

public class Either<A, B> implements Iterable<B> {
@NullMarked
public class Either<A extends @Nullable Object, B extends @Nullable Object> implements Iterable<B> {
private final A left;
private final B right;

Expand All @@ -31,11 +34,11 @@ private Either(A a, B b) {
right = b;
}

public static <A, B> Either<A, B> left(A a) {
public static <A extends @Nullable Object, B extends @Nullable Object> Either<A, B> left(A a) {
return new Either<>(a, null);
}

public static <A, B> Either<A, B> right(B b) {
public static <A extends @Nullable Object, B extends @Nullable Object> Either<A, B> right(B b) {
return new Either<>(null, b);
}

Expand Down
19 changes: 13 additions & 6 deletions java/src/org/openqa/selenium/virtualauthenticator/Credential.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,21 @@ public static Credential createResidentCredential(

/** Creates a credential from a map. */
public static Credential fromMap(Map<String, Object> map) {
Object credentialId = Require.nonNull("credentialId", map.get("credentialId"));
Object isResidentCredential =
Require.nonNull("isResidentCredential", map.get("isResidentCredential"));
Object rpId = Require.nonNull("rpId", map.get("rpId"));
Object privateKey = Require.nonNull("privateKey", map.get("privateKey"));
Object userHandle = map.get("userHandle");
Object signCount = Require.nonNull("signCount", map.get("signCount"));
Base64.Decoder decoder = Base64.getUrlDecoder();
return new Credential(
decoder.decode((String) map.get("credentialId")),
(boolean) map.get("isResidentCredential"),
(String) map.get("rpId"),
new PKCS8EncodedKeySpec(decoder.decode((String) map.get("privateKey"))),
map.get("userHandle") == null ? null : decoder.decode((String) map.get("userHandle")),
((Long) map.get("signCount")).intValue());
decoder.decode((String) credentialId),
(boolean) isResidentCredential,
(String) rpId,
new PKCS8EncodedKeySpec(decoder.decode((String) privateKey)),
userHandle == null ? null : decoder.decode((String) userHandle),
((Long) signCount).intValue());
}

private Credential(
Expand Down