pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Green <james.mk.gr...@gmail.com>
Subject Warning when using PDFTextStripper
Date Mon, 11 Mar 2013 15:08:09 GMT
I have a unit test which features the following method:

    private void checkPage(final PDDocument rendered, final int pageNumber,
final List<String> expected, final List<String> unexpected) throws
IOException {
        PDFTextStripper stripper = new PDFTextStripper();
        stripper.setStartPage(pageNumber);
        stripper.setEndPage(pageNumber);
        System.out.println("checkPage is getting text");
        String content = stripper.getText(rendered);
        System.out.println("checkPage has text");
        for (String expect : expected) {
            Assert.assertTrue(content.contains(expect));
        }
        for (String unexpect : unexpected) {
            Assert.assertFalse(content.contains(unexpect));
        }
    }

Between "checkPage is getting text" and "checkPage is getting text" on the
console I get:

14:56:45,765  WARN org.apache.pdfbox.cos.COSDocument:530 finalize() -
Warning: You did not close a PDF Document

I realise that System.gc() might be happening at some other point but as
yet I have failed to spot any reason behind this warning. It is consistent
in appearing between these two messages under repeated execution.

PDFBox 1.7.1 is being used. Any ideas?

Thanks,

James

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message