From 9c96057ac77521461cfa154b37d22713df167d9a Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Fri, 3 Apr 2020 10:00:49 -0700 Subject: [PATCH] Fixed builder changes that I approved that were wrong (#9809) --- .../data/appconfiguration/ConfigurationClientBuilder.java | 7 ++++--- .../azure/ai/textanalytics/TextAnalyticsClientBuilder.java | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java index 2c648bac1566a..704c36668d296 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java @@ -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) { @@ -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); diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java index b30c64e8a787c..74d98eee91276 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java @@ -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) { @@ -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);