You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jochen Wiedmann (JIRA)" <ji...@apache.org> on 2009/01/18 02:32:59 UTC

[jira] Resolved: (FILEUPLOAD-162) NullPtr after object unserialized because file cleaned meanwhile

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

Jochen Wiedmann resolved FILEUPLOAD-162.
----------------------------------------

    Resolution: Won't Fix
      Assignee: Jochen Wiedmann

Serializable file items have been a design error right from the start. If you have issues like yours, please use a custom FileItemFactory.


> NullPtr after object unserialized because file cleaned meanwhile
> ----------------------------------------------------------------
>
>                 Key: FILEUPLOAD-162
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-162
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: all
>            Reporter: Alain Coetmeur
>            Assignee: Jochen Wiedmann
>            Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When I serialize DiskFileItem which are not 'inmemory' and unserialize them back,
> I get a crash in isInMemory, because the file cited in the serialized content have been deleted meanwhile.
> here is a patch I propose
> private void writeObject(ObjectOutputStream out) throws IOException {
> 		// Read the data
> 		cachedContent=get();// get in mem before serialize en mémoire
> 		// write out values
> 		out.defaultWriteObject();
>                 cachedContent=null;//clean mem... not so usefull since object will probably die soon, but...
> 	}
> 	

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