Skip to content

Commit

Permalink
explicitly create the swing password panel on the swing thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Feuermagier committed Sep 22, 2024
1 parent 4fb03b7 commit a29bedd
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
package edu.kit.kastel.sdq.artemis4j.grading.git;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.Optional;

import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.*;

import edu.kit.kastel.sdq.artemis4j.ArtemisNetworkException;
import edu.kit.kastel.sdq.artemis4j.grading.ArtemisConnection;
Expand Down Expand Up @@ -136,8 +132,14 @@ public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCreden
}
} else if (item instanceof CredentialItem.Password passwordItem) {
if (this.passphrase == null) {
this.passphrase = PasswordPanel.show("Clone via SSH", passwordItem.getPromptText())
.orElse(null);
try {
SwingUtilities.invokeAndWait(() -> {
this.passphrase = PasswordPanel.show("Clone via SSH", passwordItem.getPromptText())
.orElse(null);
});
} catch (InterruptedException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}

if (this.passphrase != null) {
Expand Down

0 comments on commit a29bedd

Please sign in to comment.