You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Thomas Vandahl (JIRA)" <ji...@apache.org> on 2007/04/10 17:47:32 UTC

[jira] Created: (FILEUPLOAD-134) A factory-created DiskFileItem does not have an initialized dfos, causing NullPointerExceptions if getOutputStream() is not called.

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


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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Resolved: (FILEUPLOAD-134) A factory-created DiskFileItem does not have an initialized dfos, causing NullPointerExceptions if getOutputStream() is not called.

Posted by "Jochen Wiedmann (JIRA)" <ji...@apache.org>.
     [ 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org