diff options
author | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-10-12 14:46:03 +0200 |
---|---|---|
committer | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-10-12 14:46:03 +0200 |
commit | 7be16d5f6a9e48137232d7bece96d30825229911 (patch) | |
tree | 4abdab309ce1866a9010da1c36261ec3f3b502ef /pdf-over-gui/src/main/java | |
parent | 8e644e3b7a3f043ad1f57065554271f728440285 (diff) | |
download | pdf-over-7be16d5f6a9e48137232d7bece96d30825229911.tar.gz pdf-over-7be16d5f6a9e48137232d7bece96d30825229911.tar.bz2 pdf-over-7be16d5f6a9e48137232d7bece96d30825229911.zip |
More specific error when keystore file does not exist
Diffstat (limited to 'pdf-over-gui/src/main/java')
3 files changed, 19 insertions, 2 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java index 0596f708..6dda2956 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java @@ -278,7 +278,7 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite { } catch (FileNotFoundException ex) { log.error("Error loading keystore", ex); //$NON-NLS-1$ showErrorDialog(String.format(Messages.getString( - "error.FileNotExist"), f.getName())); //$NON-NLS-1$ + "error.KeyStoreFileNotExist"), f.getName())); //$NON-NLS-1$ } catch (NoSuchAlgorithmException ex) { log.error("Error loading keystore", ex); //$NON-NLS-1$ showErrorDialog(Messages.getString("error.KeyStore")); //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java index f0b4f8f0..7578d1c3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java @@ -33,6 +33,6 @@ public class KeystoreDoesntExistException extends ResumableException { * @param resumeIndex The resume Index */ public KeystoreDoesntExistException(final File keystore, int resumeIndex) { - super(String.format(Messages.getString("error.FileNotExist"), keystore.getPath()), resumeIndex); //$NON-NLS-1$ + super(String.format(Messages.getString("error.KeyStoreFileNotExist"), keystore.getPath()), resumeIndex); //$NON-NLS-1$ } } 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 eaeba4c8..2e5c0d75 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 @@ -16,6 +16,8 @@ package at.asit.pdfover.gui.workflow.states; // Imports +import java.io.File; + import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,6 +68,21 @@ public class KSState extends State { try { String file = config.getKeyStoreFile(); + File f = new File(file); + if (!f.isFile()) { + log.error("Keystore not found"); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog( + getStateMachine().getGUIProvider().getMainShell(), + String.format(Messages.getString("error.KeyStoreFileNotExist"), f.getName()), //$NON-NLS-1$ + BUTTONS.RETRY_CANCEL); + if (dialog.open() != SWT.RETRY) { + //getStateMachine().exit(); + this.setNextState(new BKUSelectionState(getStateMachine())); + return; + } + this.run(); + return; + } String alias = config.getKeyStoreAlias(); String storePass = config.getKeyStoreStorePass(); if (storePass.isEmpty()) { |