You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by bu...@apache.org on 2007/06/04 18:26:08 UTC

DO NOT REPLY [Bug 40202] - running away tmp files

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40202>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40202





------- Additional Comments From eulguignol@gmail.com  2007-06-04 09:26 -------
The problem is that there is no reference on the temporary file.

To solve the problem, I made a TempFileInputStream (extending FileInputStream)
that delete the file on fileinputStream close method.


The inner class :

    public class TempFileInputStream extends FileInputStream {

    	protected File tmpFile = null;

    	public TempFileInputStream (File file) throws FileNotFoundException {
    		super(file);
    		this.tmpFile = file;
    	}
    	
    	public void close () {
			try {
				super.close();
				tmpFile.delete();
			} catch (IOException e) {
				e.printStackTrace();
			}
  		
    	}
    }

The modification in NodeRevisionContent

            long length = FileHelper.globalBufferCopy(is, os);
---            InputStream bis = new BufferedInputStream(new
FileInputStream(buffer));
---            setContent(bis);
+++            setContent(new TempFileInputStream(buffer));

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org