aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java12
1 files changed, 10 insertions, 2 deletions
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!");
}