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

MultipartStream.discardBodyData() implementation is redundant.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1 Final
    • Fix Version/s: None
    • Labels:
      None

      Description

      MultipartStream.discardBodyData() is identical to readBodyData() - copied and pasted, but with output removed.

      discardBodyData() can be changed to call readBodyData() with a NullInputStream (from commons io package, which is already a dependency). This is much more readable and maintainable, and much less error prone.

      (Alternatively, readBodyData() can be modified to handle a null output stream by performing a null check before writing into it, and skipping the writes if output is null. then discardBodyData() can call it with a null argument. However, the first solution seems more elegant.)

        Attachments

        1. commons-fileupload-1.patch
          4 kB
          Jochen Wiedmann
        2. commons-fileupload-1.1-bug-109.patch
          2 kB
          Amichai Rothman

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              amichai Amichai Rothman
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: