fix pdfParser not closed warning from pdfbox

for encrypted pdf on exit due to missing permission to extract
pull/1/head
reger 11 years ago
parent c798a9d1bb
commit 09f73b790f

@ -107,8 +107,10 @@ public class pdfParser extends AbstractParser implements Parser {
throw new Parser.Failure("Document is encrypted (3): " + e.getMessage(), location);
}
final AccessPermission perm = pdfDoc.getCurrentAccessPermission();
if (perm == null || !perm.canExtractContent())
if (perm == null || !perm.canExtractContent()) {
try {pdfDoc.close();} catch (final IOException ee) {}
throw new Parser.Failure("Document is encrypted and cannot be decrypted", location);
}
}
// extracting some metadata

Loading…
Cancel
Save