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

PDFTextStripper - ScratchFileBuffer not closed!

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      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. test.pdf
          2.22 MB
          Roman Pichlik
        2. PDFStripperTest.java
          2 kB
          Roman Pichlik
        3. CloseablePDFParser.java
          17 kB
          Roman Pichlik

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dagi Roman Pichlik
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: