Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3388

PDFTextStripper - ScratchFileBuffer not closed!

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None

    Description

      PDFTextStripper or inherently used classes probably do not close all opened streams under all circumstances. You can reproduce that by the following snippet of code and the attached PDF file.

      try (RandomAccessBuffer rab = new RandomAccessBuffer(is)) {
                  PDFParser parser = new PDFParser(rab);
                  parser.parse();
                  try (COSDocument cosDoc = parser.getDocument();PDDocument pdDoc = new PDDocument(cosDoc);){
                      PDFTextStripper pdfStripper = new PDFTextStripper();
                      pdfStripper.getText(pdDoc);
                  }
              } catch (IOException e) {
                  throw new RuntimeException(e);
              }
      

      Attachments

        1. CloseablePDFParser.java
          17 kB
          Roman Pichlik
        2. PDFStripperTest.java
          2 kB
          Roman Pichlik
        3. test.pdf
          2.22 MB
          Roman Pichlik

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dagi Roman Pichlik
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: