Skip to content

Commit

Permalink
Fix bug: type HTTP is not compatible with address null
Browse files Browse the repository at this point in the history
  • Loading branch information
andxu committed Jul 20, 2021
1 parent 6a75b94 commit 7866ca7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -237,7 +238,7 @@ protected Azure.Authenticated authTenant(String tenantId) {
.withInterceptor(new TelemetryInterceptor())
.withInterceptor(new RestExceptionHandlerInterceptor())
.withUserAgent(CommonSettings.USER_AGENT)
.withProxy(new Proxy(Proxy.Type.HTTP, com.microsoft.azure.toolkit.lib.Azure.az().config().getHttpProxy()))
.withProxy(createProxyFromConfig())
.authenticate(credentials);
}

Expand All @@ -246,7 +247,11 @@ protected InsightsManager authApplicationInsights(String subscriptionId, String
return buildAzureManager(InsightsManager.configure())
.withInterceptor(new TelemetryInterceptor())
.withInterceptor(new RestExceptionHandlerInterceptor())
.withProxy(new Proxy(Proxy.Type.HTTP, com.microsoft.azure.toolkit.lib.Azure.az().config().getHttpProxy()))
.withProxy(createProxyFromConfig())
.authenticate(credentials, subscriptionId);
}

private static Proxy createProxyFromConfig() {
return Optional.of(com.microsoft.azure.toolkit.lib.Azure.az().config().getHttpProxy()).map(proxy -> new Proxy(Proxy.Type.HTTP, proxy)).orElse(null);
}
}

0 comments on commit 7866ca7

Please sign in to comment.