diff options
3 files changed, 41 insertions, 4 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java index 93e5844c..2c4ef3bf 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java @@ -277,16 +277,51 @@ public class PrepareConfigurationState extends State { } // Read cli arguments for config file first - this.initializeFromArguments(this.stateMachine.getCmdArgs(), - this.configFileHandler); + try { + this.initializeFromArguments(this.stateMachine.getCmdArgs(), + this.configFileHandler); + } catch (InitializationException e) { + log.error("Error in cmd line arguments: ", e); //$NON-NLS-1$ + ErrorDialog error = new ErrorDialog(this.stateMachine + .getGUIProvider().getMainShell(), + Messages.getString("error.CmdLineArgs"), //$NON-NLS-1$ + BUTTONS.OK); + // error.setException(e); + // this.setNextState(error); + error.open(); + this.stateMachine.exit(); + } // initialize from config file this.initializeFromConfigurationFile(this.stateMachine .getConfigProvider().getConfigurationFile()); // Read cli arguments - this.initializeFromArguments(this.stateMachine.getCmdArgs(), - this.handler); + try { + this.initializeFromArguments(this.stateMachine.getCmdArgs(), + this.handler); + } catch (InitializationException e) { + log.error("Error in cmd line arguments: ", e); //$NON-NLS-1$ + ErrorDialog error; + + if (e.getCause() instanceof FileNotFoundException) { + error = new ErrorDialog(this.stateMachine + .getGUIProvider().getMainShell(), + String.format( + Messages.getString("error.FileNotExist"), //$NON-NLS-1$ + e.getCause().getMessage()), + BUTTONS.OK); + } else { + error = new ErrorDialog(this.stateMachine + .getGUIProvider().getMainShell(), + Messages.getString("error.CmdLineArgs"), //$NON-NLS-1$ + BUTTONS.OK); + } + // error.setException(e); + // this.setNextState(error); + error.open(); + this.stateMachine.exit(); + } // Set usedSignerLib ... this.stateMachine.getPDFSigner().setUsedPDFSignerLibrary( diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index caf3bddf..8960cd75 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -61,6 +61,7 @@ config.Simple=Basi&c dataSourceSelection.DropLabel=Drag document here dataSourceSelection.DropLabel2=or... dataSourceSelection.browse=&Browse for PDF on your computer +error.CmdLineArgs=Error parsing the command-line arguments error.Details=Details error.EnteredReferenceValue=You entered the reference value! error.FailedToGetSignedDocument=Failed to get signed document. diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index bba26c83..500ddeed 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -61,6 +61,7 @@ config.Simple=&Einfach dataSourceSelection.DropLabel=Dokument hierher ziehen dataSourceSelection.DropLabel2=oder... dataSourceSelection.browse=&Durchsuchen um ein Dokument zu wählen +error.CmdLineArgs=Fehler bei den Befehlszeilen-Parametern error.Details=Details error.EnteredReferenceValue=Sie haben den Vergleichswert eingegeben! error.FailedToGetSignedDocument=Konnte signiertes Dokument nicht erhalten. |