From e123b037e65b336c677c0a66125ae85f5827417a Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 30 Oct 2014 16:10:41 +0100 Subject: NPE when processing Signature fields, sig fields without dictionary --- .../lib/impl/signing/pdfbox/PADESPDFBOXSigner.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'pdf-as-pdfbox/src') diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java index 14082a10..655a144e 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java @@ -131,10 +131,10 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { FileInputStream fis = new FileInputStream(new File(fisTmpFile)); doc = pdfObject.getDocument(); - + SignaturePlaceholderData signaturePlaceholderData = PlaceholderFilter - .checkPlaceholderSignature(pdfObject.getStatus(), - pdfObject.getStatus().getSettings()); + .checkPlaceholderSignature(pdfObject.getStatus(), pdfObject + .getStatus().getSettings()); TablePos tablePos = null; @@ -384,11 +384,16 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { if (fields != null) { for (PDField pdField : fields) { - if (pdField instanceof PDSignatureField) { - if (((PDSignatureField) pdField).getSignature() - .getDictionary() - .equals(signature.getDictionary())) { - signatureField = (PDSignatureField) pdField; + if (pdField != null) { + if (pdField instanceof PDSignatureField) { + PDSignatureField tmpSigField = (PDSignatureField) pdField; + if (tmpSigField.getSignature() != null && + tmpSigField.getSignature().getDictionary() != null) { + if (tmpSigField.getSignature().getDictionary() + .equals(signature.getDictionary())) { + signatureField = (PDSignatureField) pdField; + } + } } } } -- cgit v1.2.3