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/src/main/java/at | |
parent | fffcd3421242c9727ba28b8f75f4a04e7e93ba09 (diff) | |
download | pdf-over-246401ab6bf788c01398fe9555bea58851c63a0a.tar.gz pdf-over-246401ab6bf788c01398fe9555bea58851c63a0a.tar.bz2 pdf-over-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/src/main/java/at')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java | 43 |
1 files changed, 39 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( |