Browse Source

warn if saved certificate file could not be deleted

terminal
Craig Raw 3 years ago
parent
commit
b0f60bb671
  1. 5
      src/main/java/com/sparrowwallet/sparrow/AppServices.java
  2. 7
      src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java

5
src/main/java/com/sparrowwallet/sparrow/AppServices.java

@ -292,9 +292,12 @@ public class AppServices {
"\n\nThis may indicate a man-in-the-middle attack!" +
"\n\nDo you still want to proceed?", ButtonType.NO, ButtonType.YES);
if(optButton.isPresent() && optButton.get() == ButtonType.YES) {
crtFile.delete();
if(crtFile.delete()) {
Platform.runLater(() -> restartService(connectionService));
return;
} else {
AppServices.showErrorDialog("Could not delete certificate", "The certificate file at " + crtFile.getAbsolutePath() + " could not be deleted.\n\nPlease delete this file manually.");
}
}
}
}

7
src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java

@ -587,11 +587,12 @@ public class ServerPreferencesController extends PreferencesDetailController {
Optional<ButtonType> optButton = AppServices.showErrorDialog("SSL Handshake Failed", "The certificate provided by the server at " + tlsServerException.getServer().getHost() + " appears to have changed." +
"\n\nThis may indicate a man-in-the-middle attack!" +
"\n\nDo you still want to proceed?", ButtonType.NO, ButtonType.YES);
if(optButton.isPresent()) {
if(optButton.get() == ButtonType.YES) {
savedCrtFile.delete();
if(optButton.isPresent() && optButton.get() == ButtonType.YES) {
if(savedCrtFile.delete()) {
Platform.runLater(this::startElectrumConnection);
return;
} else {
AppServices.showErrorDialog("Could not delete certificate", "The certificate file at " + savedCrtFile.getAbsolutePath() + " could not be deleted.\n\nPlease delete this file manually.");
}
}
}

Loading…
Cancel
Save