[ 
https://issues.apache.org/jira/browse/FILEUPLOAD-134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jochen Wiedmann resolved FILEUPLOAD-134.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.1

The method DiskFileItem.getStorageLocation() is now checking for dfos == null.


> A factory-created DiskFileItem does not have an initialized dfos, causing 
> NullPointerExceptions if getOutputStream() is not called.
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-134
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-134
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: Thomas Vandahl
>             Fix For: 1.2.1
>
>
> When upgrading the Turbine code to commons-fileupload 1.2, I got NPEs in Unit 
> tests dealing with DiskFileItems. In that special case, a FileItem was 
> created like this:
>         ParameterParser pp = new DefaultParameterParser();
>         DiskFileItemFactory factory = new DiskFileItemFactory(10240, new 
> File("."));
>         FileItem test = factory.createItem("upload-field", 
> "application/octet-stream", false, null);
>         pp.add("upload-field", test);
>         assertTrue(pp.toString().startsWith("{upload-field=[name=null"));
> pp.toString() causes a call to test.toString() which (among other things) 
> calls dfos.getFile(). This fails because dfos is not initialized before 
> getOutputStream() is called.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to