From ca6544acdadbc42dbbc9be68718782eeb815b0ad Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 7 Nov 2012 10:02:36 +0100 Subject: + localized error "This may not be a PDF File" --- .../at/asit/pdfover/gui/composites/PositioningComposite.java | 9 +++++++-- .../at/asit/pdfover/gui/workflow/states/PositioningState.java | 2 +- .../src/main/resources/at/asit/pdfover/gui/messages.properties | 1 + .../main/resources/at/asit/pdfover/gui/messages_de.properties | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index d612f3c9..c7e1b7b7 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -173,8 +173,13 @@ public class PositioningComposite extends StateComposite { .map(FileChannel.MapMode.READ_ONLY, 0, chan.size()); chan.close(); rafile.close(); - - this.pdf = new PDFFile(buf); + try + { + this.pdf = new PDFFile(buf); + } + catch (IOException e) { + throw new IOException(Messages.getString("error.MayNotBeAPDF"), e); //$NON-NLS-1$ + } if (this.viewer == null) { this.viewer = new SignaturePanel(this.pdf); this.frame.add(this.viewer); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index 44513806..d877cdcf 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -101,7 +101,7 @@ public class PositioningState extends State { log.error("Failed to display PDF document", e); //$NON-NLS-1$ ErrorDialog dialog = new ErrorDialog( this.stateMachine.getGUIProvider().getMainShell(), - e.getMessage(), ERROR_BUTTONS.RETRY_CANCEL); + e.getLocalizedMessage(), ERROR_BUTTONS.RETRY_CANCEL); if(dialog.open() == SWT.RETRY) { this.stateMachine.update(); } else { diff --git a/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index a60175fa..413e9db5 100644 --- a/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -77,6 +77,7 @@ error.SignaturePanel.NoRender="Could not render page" error.TanTooLong=Entered TAN too long error.Unexpected=Unexpected Error error.title=Error +error.MayNotBeAPDF=This may not be a PDF File exception.InvalidEmblemFile=%s is an invalid signature logo file! exception.InvalidPort=%s is invalid: has to be a number between %d and %d exception.PasswordTooLong=Given password is too long! diff --git a/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index 789880f9..c3a1d302 100644 --- a/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/trunk/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -77,6 +77,7 @@ error.SignaturePanel.NoRender="Konnte Seite nicht darstellen" error.TanTooLong=Eingegebener TAN zu lange error.Unexpected=Unerwarteter Fehler error.title=Fehler +error.MayNotBeAPDF=Dies ist möglicherweise keine PDF Datei exception.InvalidEmblemFile=%s ist eine ungültige Bildmarken-Datei! exception.InvalidPort=%s ist ungültig: muss eine Nummer zwischen %d und %d sein. exception.PasswordTooLong=Eingegebenes Passwort ist zu lange! -- cgit v1.2.3