From 1d5e1f5f429d225e14f4ce9e6e82a403eac10b6b Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 8 May 2014 14:11:55 +0200 Subject: Performance Test, Web Options --- .../pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pdf-as-lib/src') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java index 68257861..44919b1c 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java @@ -94,7 +94,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { String fisTmpFile = null; TempFileHelper helper = pdfObject.getStatus().getTempFileHelper(); - + PDDocument doc = null; try { fisTmpFile = helper.getStaticFilename(); @@ -104,7 +104,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { FileInputStream fis = new FileInputStream(new File(fisTmpFile)); - PDDocument doc = pdfObject.getDocument(); + doc = pdfObject.getDocument(); PDSignature signature = new PDSignature(); signature.setFilter(COSName.getPDFName(signer.getPDFFilter())); // default @@ -402,6 +402,14 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { logger.error(MessageResolver.resolveMessage("error.pdf.sig.01"), e); throw new PdfAsException("error.pdf.sig.01", e); } finally { + if(doc != null) { + try { + doc.close(); + } catch (IOException e) { + logger.debug("Failed to close COS Doc!", e); + // Ignore + } + } logger.info("Signature done!"); } -- cgit v1.2.3