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

Missing (auto)close on RandomFileAccess in CCITTFactory

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.3
    • Fix Version/s: None
    • Component/s: PDModel
    • Labels:
      None
    • Environment:
      Windows 10/64, java version "1.8.0_112" Java(TM) SE Runtime Environment (build 1.8.0_112-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

      Description

      In org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory the method createFromFile instantiates a new RandomAccessFile but does not close it when done. This keeps a lock on the File untill the JVM is closed.
      Using close or autocloseable resolves the issue.

      public static PDImageXObject createFromFile(PDDocument document, File file, int number)
      throws IOException

      { return createFromRandomAccessImpl(document, new RandomAccessFile(file, "r"), number); }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                maurice_71 Maurice Betzel
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: