diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:35:39 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:35:39 +0000 |
commit | 246401ab6bf788c01398fe9555bea58851c63a0a (patch) | |
tree | e6f12199a12e3383e5635f3e1d88537590d2dccc /pdf-over-gui | |
parent | fffcd3421242c9727ba28b8f75f4a04e7e93ba09 (diff) | |
download | mocca-246401ab6bf788c01398fe9555bea58851c63a0a.tar.gz mocca-246401ab6bf788c01398fe9555bea58851c63a0a.tar.bz2 mocca-246401ab6bf788c01398fe9555bea58851c63a0a.zip |
Provide error message for cmd line args
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@401 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui')
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. |