Skip to content

Commit 5549023

Browse files
committed
Fix error of cancelling device code login.
1 parent c8f8b13 commit 5549023

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Utils/azuretools-core/src/com/microsoft/azuretools/authmanage/AuthMethodManager.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@
5050
import static com.microsoft.azuretools.telemetry.TelemetryConstants.RESIGNIN;
5151
import static com.microsoft.azuretools.telemetry.TelemetryConstants.SIGNIN_METHOD;
5252

53+
import lombok.Lombok;
5354
import reactor.core.publisher.Hooks;
5455
import reactor.core.publisher.Mono;
5556
import reactor.core.scheduler.Schedulers;
57+
import rx.exceptions.Exceptions;
5658

5759
public class AuthMethodManager {
5860
private static final org.apache.log4j.Logger LOGGER =
@@ -66,7 +68,8 @@ public class AuthMethodManager {
6668
static {
6769
// fix the class load problem for intellij plugin
6870
ClassLoader current = Thread.currentThread().getContextClassLoader();
69-
Logger.getLogger(com.microsoft.aad.adal4j.AuthenticationContext.class).setLevel(Level.OFF);
71+
Logger.getLogger("com.microsoft.aad.msal4j.PublicClientApplication").setLevel(Level.OFF);
72+
7073
try {
7174
Thread.currentThread().setContextClassLoader(AuthMethodManager.class.getClassLoader());
7275
HttpClientProviders.createInstance();
@@ -75,6 +78,14 @@ public class AuthMethodManager {
7578
com.microsoft.azure.toolkit.lib.Azure.az(AzureCloud.class)
7679
.set(AzureEnvironmentUtils.stringToAzureEnvironment(CommonSettings.getEnvironment().getName()));
7780
}
81+
Hooks.onErrorDropped(ex -> {
82+
if (Exceptions.getFinalCause(ex) instanceof InterruptedException) {
83+
LOGGER.info(ex.getMessage());
84+
}
85+
throw Lombok.sneakyThrow(ex);
86+
});
87+
88+
7889
} finally {
7990
Thread.currentThread().setContextClassLoader(current);
8091
}

0 commit comments

Comments
 (0)