Skip to content

Commit

Permalink
Fixed builder changes that I approved that were wrong (#9809)
Browse files Browse the repository at this point in the history
  • Loading branch information
alzimmermsft authored Apr 3, 2020
1 parent 820e1d2 commit 9c96057
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 @@ -184,6 +184,9 @@ public ConfigurationAsyncClient buildAsyncClient() {
policies.add(new AddHeadersPolicy(headers));

HttpPolicyProviders.addBeforeRetryPolicies(policies);

policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);

policies.add(new AddDatePolicy());

if (tokenCredential != null) {
Expand All @@ -195,11 +198,9 @@ public ConfigurationAsyncClient buildAsyncClient() {
policies.add(new ConfigurationCredentialsPolicy(credential));
} else {
// Throw exception that credential and tokenCredential cannot be null
logger.logExceptionAsError(
throw logger.logExceptionAsError(
new IllegalArgumentException("Missing credential information while building a client."));
}

policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);

policies.addAll(this.policies);
HttpPolicyProviders.addAfterRetryPolicies(policies);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ public TextAnalyticsAsyncClient buildAsyncClient() {
policies.add(new AddHeadersPolicy(headers));

HttpPolicyProviders.addBeforeRetryPolicies(policies);

policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);

policies.add(new AddDatePolicy());
// Authentications
if (tokenCredential != null) {
Expand All @@ -182,7 +185,7 @@ public TextAnalyticsAsyncClient buildAsyncClient() {
throw logger.logExceptionAsError(
new IllegalArgumentException("Missing credential information while building a client."));
}
policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy);

policies.addAll(this.policies);
HttpPolicyProviders.addAfterRetryPolicies(policies);

Expand Down

0 comments on commit 9c96057

Please sign in to comment.