Sebb created FILEUPLOAD-250:
-------------------------------

             Summary: FileUploadBase - potential resource leak - InputStream 
not closed on exception
                 Key: FILEUPLOAD-250
                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-250
             Project: Commons FileUpload
          Issue Type: Bug
            Reporter: Sebb


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.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to