From 2a93094bb440c354d5b9dda20890bc537d305ba2 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 18 Nov 2015 09:30:05 +0100 Subject: protect PDDocument loading, for multithreading --- .../src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXObject.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pdf-as-pdfbox/src/main/java/at') diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXObject.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXObject.java index ef4c055c..d3babcb2 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXObject.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXObject.java @@ -47,7 +47,9 @@ public class PDFBOXObject extends PDFObject { if(doc != null) { doc.close(); } - this.doc = PDDocument.load(this.originalDocument.getInputStream()); + synchronized(PDDocument.class) { + this.doc = PDDocument.load(this.originalDocument.getInputStream()); + } if(this.doc != null) { this.doc.getDocument().setWarnMissingClose(false); } -- cgit v1.2.3