Skip to content

Commit 823a9f7

Browse files
committed
- fixes a bug where a null collection for allowed hosts would fail client initialization
1 parent 8007610 commit 823a9f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/microsoft/graph/core/authentication/AzureIdentityAccessTokenProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.microsoft.graph.core.authentication;
22

33
import java.util.HashSet;
4+
import java.util.Objects;
45

56
import jakarta.annotation.Nonnull;
67
import jakarta.annotation.Nullable;
@@ -22,7 +23,7 @@ public AzureIdentityAccessTokenProvider(@Nonnull TokenCredential tokenCredential
2223
public AzureIdentityAccessTokenProvider(@Nonnull final TokenCredential tokenCredential, @Nonnull final String[] allowedHosts,
2324
@Nullable final ObservabilityOptions observabilityOptions, @Nonnull final String... scopes) {
2425
super(tokenCredential, allowedHosts, observabilityOptions, scopes);
25-
if (allowedHosts.length == 0) {
26+
if (allowedHosts == null || allowedHosts.length == 0) {
2627
final HashSet<String> allowedHostsSet = new HashSet<String>();
2728
allowedHostsSet.add("graph.microsoft.com");
2829
allowedHostsSet.add("graph.microsoft.us");

0 commit comments

Comments
 (0)