Skip to content

Commit

Permalink
fix exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitc1 committed Jan 3, 2025
1 parent 319508c commit 3a6a513
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import com.microsoft.identity.common.internal.util.CommonMoshiJsonAdapter;
import com.microsoft.identity.common.internal.util.ProcessUtil;
import com.microsoft.identity.common.java.configuration.LibraryConfiguration;
import com.microsoft.identity.common.java.exception.ClientException;
import com.microsoft.identity.common.java.logging.DiagnosticContext;
import com.microsoft.identity.common.java.opentelemetry.SerializableSpanContext;
import com.microsoft.identity.common.java.opentelemetry.SpanExtension;
Expand Down Expand Up @@ -233,7 +234,7 @@ public static Intent signInWithGoogleAndGetAuthorizationActivityIntent(final Con
final boolean webViewZoomControlsEnabled,
final String sourceLibraryName,
final String sourceLibraryVersion,
@NonNull final SignInWithGoogleParameters signInWithGoogleParameters) {
@NonNull final SignInWithGoogleParameters signInWithGoogleParameters) throws ClientException {
final SignInWithGoogleCredential signInWithGoogleCredential = SignInWithGoogleApi.getInstance().signInSync(signInWithGoogleParameters);
return getAuthorizationActivityIntent(
context,
Expand Down Expand Up @@ -277,7 +278,7 @@ public static Intent getAuthorizationActivityIntent(final Context context,
final String sourceLibraryName,
final String sourceLibraryVersion,
@NonNull final SignInWithGoogleCredential signInWithGoogleCredential
) {
) throws ClientException {
// add header
final HashMap<String, String> requestHeadersWithGoogleAuthCredential = requestHeaders == null? new HashMap<>() : new HashMap<>(requestHeaders);
requestHeadersWithGoogleAuthCredential.putAll(signInWithGoogleCredential.asHeaders());
Expand All @@ -288,8 +289,8 @@ public static Intent getAuthorizationActivityIntent(final Context context,
final CommonURIBuilder uriBuilder = new CommonURIBuilder(requestUrl);
uriBuilder.addParameterIfAbsent(MsaFederationConstants.MSA_ID_PROVIDER_EXTRA_QUERY_PARAM_KEY, FederatedSignInProviderName.GOOGLE.getIdProviderName());
requestUrlWithIdProvider = uriBuilder.build().toString();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
} catch (final URISyntaxException e) {
throw new ClientException(ClientException.MALFORMED_URL, "Failed to add id provider query parameter to request URL", e);
}

return getAuthorizationActivityIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@

import java.util.HashMap;

import lombok.SneakyThrows;

/**
* Tests for @link{AuthorizationActivityFactory}.
*/
@RunWith(RobolectricTestRunner.class)
public class AuthorizationActivityFactoryTest {

@SneakyThrows
@Test
public void testGetAuthorizationActivityIntent() {
// Arrange
Expand Down

0 comments on commit 3a6a513

Please sign in to comment.