Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

fix: Settings objects should not try to read quotaProjectId from credentials #1162

Merged
merged 3 commits into from Aug 7, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions gax/src/main/java/com/google/api/gax/rpc/StubSettings.java
Expand Up @@ -41,7 +41,6 @@
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.tracing.ApiTracerFactory;
import com.google.api.gax.tracing.NoopApiTracerFactory;
import com.google.auth.Credentials;
import com.google.auth.oauth2.QuotaProjectIdProvider;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -266,14 +265,6 @@ public B setExecutorProvider(ExecutorProvider executorProvider) {
/** Sets the CredentialsProvider to use for getting the credentials to make calls with. */
public B setCredentialsProvider(CredentialsProvider credentialsProvider) {
this.credentialsProvider = Preconditions.checkNotNull(credentialsProvider);
try {
Credentials credentials = credentialsProvider.getCredentials();
if (this.quotaProjectId == null && credentials instanceof QuotaProjectIdProvider) {
this.quotaProjectId = ((QuotaProjectIdProvider) credentials).getQuotaProjectId();
}
} catch (IOException e) {
System.out.println("fail to fetch credentials");
}
return self();
}

Expand Down
Expand Up @@ -420,8 +420,6 @@ public Credentials getCredentials() throws IOException {
.isEqualTo(QUOTA_PROJECT_ID_FROM_INTERNAL_HEADER_VALUE);
Truth.assertThat(builder_setQuotaFromInternalHeadersAndBuilders.getQuotaProjectId())
.isEqualTo(QUOTA_PROJECT_ID_FROM_BUILDERS);
Truth.assertThat(builder_setQuotaFromCredentialsProvider.getQuotaProjectId())
.isEqualTo(QUOTA_PROJECT_ID_FROM_CREDENTIALS_VALUE);
Truth.assertThat(builder_setQuotaFromCredentialsProviderAndBuilder.getQuotaProjectId())
.isEqualTo(QUOTA_PROJECT_ID_FROM_BUILDERS);
Truth.assertThat(builder_setQuotaFromAllSources.getQuotaProjectId())
Expand Down