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

[PATCH] Option to disable close warning in finalizer of COSDocument.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8.0-incubator
    • 0.8.0-incubator
    • None
    • None

    Description

      I'm using PDFBox in a FOP plug-in to embed PDF documents. The PDF images are cached in memory through soft references. Therefore I do not know exactly when the COSDocument needs to be closed. I do close it in the holder's finalize() method but the garbage collector sometimes calls the COSDocument's finalizer before I have a chance to close it myself. With this patch I'd like to introduce an option that lets me disable the warning and do a close() in the finalizer in any case. I do think that the warning can be helpful for newbies (closing early is a good idea when that's possible) but the warning to System.err is a problem in my case.

      If noone objects within 72 hours, I'm happy to apply the patch myself.

      Attachments

        1. COSDocumentFinalizerPatch.diff
          5 kB
          Jeremias Maerki

        Activity

          People

            jeremias@apache.org Jeremias Maerki
            jeremias@apache.org Jeremias Maerki
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: