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

View: New views
1 Messages — Rating Filter:   Alert me  

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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
            Priority: Minor


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.

LightInTheBox - Buy quality products at wholesale price