commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alain Coetmeur (JIRA)" <j...@apache.org>
Subject [jira] Created: (FILEUPLOAD-162) NullPtr after object unserialized because file cleaned meanwhile
Date Thu, 10 Jul 2008 16:54:31 GMT
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.


Mime
View raw message