Hi All,
The changes to PDDocument in eb83a299bbe39c2e59735aca2b39bca312c1ddc4
were insufficient, please include attached patch.
Thanks,
Jesse
diff --git a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
index 2b9babb..0e5ed15 100644
--- a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
+++ b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
@@ -848,11 +848,20 @@ public class PDDocument implements Closeable
MemoryUsageSetting memUsageSetting) throws IOException
{
RandomAccessBufferedFileInputStream raFile = new RandomAccessBufferedFileInputStream(file);
- PDFParser parser = new PDFParser(raFile, password, keyStore, alias, new ScratchFile(memUsageSetting));
try
{
- parser.parse();
- return parser.getPDDocument();
+ ScratchFile scratchFile = new ScratchFile(memUsageSetting);
+ try
+ {
+ PDFParser parser = new PDFParser(raFile, password, keyStore, alias, scratchFile);
+ parser.parse();
+ return parser.getPDDocument();
+ }
+ catch (IOException ioe)
+ {
+ IOUtils.closeQuietly(scratchFile);
+ throw ioe;
+ }
}
catch (IOException ioe)
{
@@ -967,10 +976,18 @@ public class PDDocument implements Closeable
String alias, MemoryUsageSetting memUsageSetting) throws IOException
{
ScratchFile scratchFile = new ScratchFile(memUsageSetting);
- RandomAccessRead source = scratchFile.createBuffer(input);
- PDFParser parser = new PDFParser(source, password, keyStore, alias, scratchFile);
- parser.parse();
- return parser.getPDDocument();
+ try
+ {
+ RandomAccessRead source = scratchFile.createBuffer(input);
+ PDFParser parser = new PDFParser(source, password, keyStore, alias, scratchFile);
+ parser.parse();
+ return parser.getPDDocument();
+ }
+ catch (IOException ioe)
+ {
+ IOUtils.closeQuietly(scratchFile);
+ throw ioe;
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]