Uploaded image for project: 'Commons FileUpload'
  1. Commons FileUpload
  2. FILEUPLOAD-250

FileUploadBase - potential resource leak - InputStream not closed on exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.1
    • 1.4
    • None

    Description

      FileUploadBase has several instances where the InputStream "input" is not closed when an Exception is throw. This can potentially be a resource leak and is best avoided.

      The first case is easy to deal with, as the InputStream does not need to be created until after the SizeLimitExceededException has been thrown.

      The next case occurs if the boundary is not found.
      This check could be moved to before the size check, however that would change the behaviour slightly, as FileUploadException would be thrown instead of SizeLimitExceededException if both boundary and size are wrong.

      The last case is where InvalidContentTypeException is thrown. This cannot easily be avoided.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sebb Sebb
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: