aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PdfAsWrappedIOException.java4
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java21
2 files changed, 23 insertions, 2 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PdfAsWrappedIOException.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PdfAsWrappedIOException.java
index 4a67abac..575dbdce 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PdfAsWrappedIOException.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PdfAsWrappedIOException.java
@@ -36,4 +36,8 @@ public class PdfAsWrappedIOException extends IOException {
super(e);
}
+ public PdfAsException getDecoratedException() {
+ return (PdfAsException) getCause();
+ }
+
}
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
index 36d7dade..7aa46149 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
@@ -73,6 +73,8 @@ import org.apache.xmpbox.xml.DomXmpParser;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.common.exceptions.PdfAsWrappedIOException;
+import at.gv.egiz.pdfas.common.exceptions.SLPdfAsException;
import at.gv.egiz.pdfas.common.messages.MessageResolver;
import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings;
import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource;
@@ -398,8 +400,13 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
runPDFAPreflight(new ByteArrayDataSource(pdfObject.getSignedDocument()));
}
- } catch (final IOException e1) {
- log.error("Can not save incremental update", e1);
+ } catch (PdfAsWrappedIOException e) {
+ logPdfUpdateError(e.getDecoratedException());
+ throw e.getDecoratedException();
+
+ } catch (final IOException e) {
+ logPdfUpdateError(e);
+ throw new PdfAsException("error.pdf.sig.06", e);
}
@@ -407,6 +414,16 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
}
+ private void logPdfUpdateError(Throwable e) {
+ if (e instanceof SLPdfAsException && !((SLPdfAsException) e).isCriticalError()) {
+ log.info("Can not save incremental update", e);
+
+ } else {
+ log.error("Can not save incremental update", e);
+
+ }
+ }
+
private void injectPdfUaContent(PDDocument doc, PDSignatureField signatureField, String sigFieldName,
SignatureProfileSettings signatureProfileSettings) throws PdfAsException {
try {