Skip to content

Commit ab875cb

Browse files
committed
Fix opening device login in browser issue with IntelliJ util
1 parent 828e642 commit ab875cb

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azuretools/ijidea/ui/DeviceLoginWindow.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
package com.microsoft.azuretools.ijidea.ui;
2424

25+
import com.intellij.ide.BrowserUtil;
2526
import com.intellij.openapi.application.ApplicationManager;
2627
import com.intellij.openapi.application.ModalityState;
2728
import com.microsoft.aad.adal4j.AdalErrorCode;
@@ -40,7 +41,6 @@
4041
import javax.swing.JPanel;
4142
import javax.swing.UIManager;
4243
import javax.swing.event.HyperlinkEvent;
43-
import javax.swing.text.html.HTMLDocument;
4444
import java.awt.Color;
4545
import java.awt.Desktop;
4646
import java.awt.Font;
@@ -50,7 +50,6 @@
5050
import java.awt.datatransfer.StringSelection;
5151
import java.awt.event.WindowEvent;
5252
import java.io.IOException;
53-
import java.net.URI;
5453
import java.net.URISyntaxException;
5554
import java.util.concurrent.ExecutionException;
5655
import java.util.concurrent.Future;
@@ -150,11 +149,7 @@ protected void doOKAction() {
150149
final StringSelection selection = new StringSelection(deviceCode.getUserCode());
151150
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
152151
clipboard.setContents(selection, selection);
153-
try {
154-
Desktop.getDesktop().browse(new URI(deviceCode.getVerificationUrl()));
155-
} catch (IOException | URISyntaxException e) {
156-
e.printStackTrace();
157-
}
152+
BrowserUtil.open(deviceCode.getVerificationUrl());
158153
}
159154

160155
private void closeDialog() {

0 commit comments

Comments
 (0)