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

Limit overwrite warning to non empty files

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.2 PDFBox
    • 3.0.3 PDFBox, 4.0.0
    • Writing
    • None

    Description

      As written by Anthony Brunellière on the dev mailing list:

      The method PDDocument.save(..) (version 3.0.2) generates a warning if the output file already exists :
      {code:java}
      public void save(File file, CompressParameters compressParameters) throws IOException
          {
              if (file.exists())
              {
                  LOG.warn(
                          "You are overwriting the existing file " + file.getName()
                                  + ", this will produce a corrupted file if you're also reading from it");
              }
      

      I understand the disclaimer "Don't use the input file as target as this will produce a corrupted file", but I'm in a context where an empty ouput file is created just before for specific reasons.

      Should this warning be limited to non-empty files?

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tilman Tilman Hausherr
            tilman Tilman Hausherr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment