From d30ea266a1b0f617e9e90ba233b345490f217b4c Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:39:08 +0000 Subject: Show useful error msg if PDF is password protected git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@434 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../java/at/asit/pdfover/gui/composites/PositioningComposite.java | 4 ++++ .../src/main/resources/at/asit/pdfover/gui/messages.properties | 3 ++- .../src/main/resources/at/asit/pdfover/gui/messages_de.properties | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index 8294c004..c9e14898 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -52,6 +52,7 @@ import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.SignaturePosition; import com.sun.pdfview.PDFFile; +import com.sun.pdfview.decrypt.PDFAuthenticationFailureException; /** * Composite which allows to position the signature on a preview of the document @@ -180,6 +181,9 @@ public class PositioningComposite extends StateComposite { { this.pdf = new PDFFile(buf); } + catch (PDFAuthenticationFailureException e) { + throw new IOException(Messages.getString("error.PDFProtected"), e); //$NON-NLS-1$ + } catch (IOException e) { throw new IOException(Messages.getString("error.MayNotBeAPDF"), e); //$NON-NLS-1$ } 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 6fa3f705..d713a009 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 @@ -77,7 +77,8 @@ error.InvalidPhoneNumber=Given phone number is invalid! Example: +43664123456789 error.InvalidSettings=Invalid settings are still present. Please check your input. error.IOError=Input/Output Error error.LocalBKU=Please check if a local CCE (citizen card environment) is running\n\nYou need a CCE to access your citizen card. Further information under www.buergerkarte.at -error.MayNotBeAPDF=This may not be a PDF File +error.MayNotBeAPDF=This may not be a PDF file +error.PDFProtected=This PDF file is password protected error.PositioningNotPossible=Manual positioning currently not possible due to a Java Bug. Using automatic positioning. error.PrepareDocument=Failed to prepare document for signature. error.Retry=Retry 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 f255a349..8c46bb2c 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 @@ -77,7 +77,8 @@ error.InvalidPhoneNumber=Telefonnummer ung error.InvalidSettings=Ungültige Einstellungen vorhanden. Bitte überprüfen. error.IOError=Ein-/Ausgabe-Fehler error.LocalBKU=Bitte prüfen sie, ob Ihre lokale BKU (Bürgerkartenumgebung) läuft\n\nSie benötigen eine BKU, um auf Ihre Bürgerkarte zuzugreifen. Weitere Informationen unter www.buergerkarte.at -error.MayNotBeAPDF=Dies ist möglicherweise keine PDF Datei +error.MayNotBeAPDF=Dies ist möglicherweise keine PDF-Datei +error.PDFProtected=Diese PDF-Datei ist Passwortgeschützt error.PositioningNotPossible=Positionsauswahl ist im Moment nicht verfügbar wegen eines Java Fehlers. Die Position wird automatisch bestimmt. error.PrepareDocument=Konnte Dokument nicht zur Signatur vorbereiten. error.Retry=Wiederholen -- cgit v1.2.3