Skip to content

Commit e955330

Browse files
committed
PR fixes
1 parent cdf9cf9 commit e955330

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Diff for: driver-core/src/main/com/mongodb/MongoCredential.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -712,29 +712,33 @@ public static final class OidcCallbackResult {
712712

713713
private final String accessToken;
714714

715-
@Nullable
716715
private final Duration expiresIn;
717716

718717
@Nullable
719718
private final String refreshToken;
720719

721720
/**
722721
* @param accessToken The OIDC access token.
723-
* @param expiresIn Time until the access token expires. 0 is an infinite duration.
722+
* @param expiresIn Time until the access token expires.
723+
* A {@linkplain Duration#isZero() zero-length} duration
724+
* means that the access token does not expire.
724725
*/
725726
public OidcCallbackResult(final String accessToken, final Duration expiresIn) {
726727
this(accessToken, expiresIn, null);
727728
}
728729

729730
/**
730731
* @param accessToken The OIDC access token.
731-
* @param expiresIn Time until the access token expires. 0 is an infinite duration.
732+
* @param expiresIn Time until the access token expires.
733+
* A {@linkplain Duration#isZero() zero-length} duration
734+
* means that the access token does not expire.
732735
* @param refreshToken The refresh token. If null, refresh will not be attempted.
733736
*/
734-
public OidcCallbackResult(final String accessToken, @Nullable final Duration expiresIn,
737+
public OidcCallbackResult(final String accessToken, final Duration expiresIn,
735738
@Nullable final String refreshToken) {
736739
notNull("accessToken", accessToken);
737-
if (expiresIn != null && expiresIn.isNegative()) {
740+
notNull("expiresIn", expiresIn);
741+
if (expiresIn.isNegative()) {
738742
throw new IllegalArgumentException("expiresIn must not be a negative value");
739743
}
740744
this.accessToken = accessToken;

Diff for: driver-sync/src/test/functional/com/mongodb/client/unified/Entities.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
import java.nio.file.Files;
7979
import java.nio.file.Path;
8080
import java.nio.file.Paths;
81+
import java.time.Duration;
8182
import java.util.ArrayList;
8283
import java.util.HashMap;
8384
import java.util.HashSet;
@@ -530,7 +531,7 @@ private void initClient(final BsonDocument entity, final String id,
530531
} catch (IOException e) {
531532
throw new RuntimeException(e);
532533
}
533-
return new MongoCredential.OidcCallbackResult(accessToken, null);
534+
return new MongoCredential.OidcCallbackResult(accessToken, Duration.ZERO);
534535
}));
535536
break;
536537
}

0 commit comments

Comments
 (0)