summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-08 14:19:39 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-08 14:19:39 +0200
commite3dba1b10fbb8ed02f4b8c4b88883027509451d1 (patch)
treea6be959f217c55aaad38332a1ec80c2c6cbf72a6 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow
parentb3ae550f4196dfc7b3b45739a04c5b1ae1859623 (diff)
downloadpdf-over-e3dba1b10fbb8ed02f4b8c4b88883027509451d1.tar.gz
pdf-over-e3dba1b10fbb8ed02f4b8c4b88883027509451d1.tar.bz2
pdf-over-e3dba1b10fbb8ed02f4b8c4b88883027509451d1.zip
sanitize config validation for #68 #69
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
index d8231e99..443f54af 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
@@ -19,7 +19,6 @@ package at.asit.pdfover.gui.workflow.states;
import java.io.File;
import java.security.Key;
import java.security.KeyStore;
-import java.security.KeyStoreException;
import java.security.UnrecoverableKeyException;
import org.eclipse.swt.SWT;
@@ -99,11 +98,11 @@ public class KSState extends State {
while (keyStore == null) {
if (storePass == null)
{
- PasswordInputDialog pwd = new PasswordInputDialog(
+ storePass = new PasswordInputDialog(
getStateMachine().getMainShell(),
Messages.getString("keystore_config.KeystoreStorePass"),
- Messages.getString("keystore.KeystoreStorePassEntry"));
- storePass = pwd.open();
+ Messages.getString("keystore.KeystoreStorePassEntry")).open();
+
if (storePass == null)
{
this.setNextState(new BKUSelectionState(getStateMachine()));
@@ -140,11 +139,11 @@ public class KSState extends State {
String keyPass = config.getKeyStoreKeyPass();
while (key == null) {
if (keyPass == null) {
- PasswordInputDialog pwd = new PasswordInputDialog(
+ keyPass = new PasswordInputDialog(
getStateMachine().getMainShell(),
Messages.getString("keystore_config.KeystoreKeyPass"),
- Messages.getString("keystore.KeystoreKeyPassEntry"));
- keyPass = pwd.open();
+ Messages.getString("keystore.KeystoreKeyPassEntry")).open();
+
if (keyPass == null)
{
this.setNextState(new BKUSelectionState(getStateMachine()));
@@ -184,16 +183,10 @@ public class KSState extends State {
signingState.setKSSigner(file, alias, storePass, keyPass, type);
} catch (SignatureException e) {
log.error("Error loading keystore", e);
- ErrorDialog dialog = new ErrorDialog(
- getStateMachine().getMainShell(),
- Messages.getString("error.KeyStore"),
- BUTTONS.RETRY_CANCEL);
- if (dialog.open() != SWT.RETRY) {
- //getStateMachine().exit();
+ if (askShouldRetry("error.KeyStore"))
+ this.run(); /* recurse */
+ else
this.setNextState(new BKUSelectionState(getStateMachine()));
- return;
- }
- this.run();
return;
}