aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
index 5f9d2b03..48d15b4d 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
@@ -139,11 +139,12 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
public List<VerifyResult> verify(VerifyParameter parameter)
throws PdfAsException {
+ PDDocument doc = null;
try {
List<VerifyResult> result = new ArrayList<VerifyResult>();
ISettings settings = (ISettings) parameter.getConfiguration();
VerifierDispatcher verifier = new VerifierDispatcher(settings);
- PDDocument doc = PDDocument.load(new ByteArrayInputStream(parameter
+ doc = PDDocument.load(new ByteArrayInputStream(parameter
.getDataSource().getByteData()));
COSDictionary trailer = doc.getDocument().getTrailer();
@@ -210,6 +211,14 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
} catch (PdfAsException e) {
logger.error("Failed to verify document", e);
throw new PdfAsException("error.pdf.verify.02", e);
+ } finally {
+ if(doc != null) {
+ try {
+ doc.close();
+ } catch (IOException e) {
+ logger.info("Failed to close doc");
+ }
+ }
}
}
@@ -236,7 +245,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
status);
status.setRequestedSignature(requestedSignature);
-
+
request.setStatus(status);
request.setNeedCertificate(true);