package de.retest.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/*
 * Taken from https://stackoverflow.com/a/4694155
 */
public class DeleteOnCloseFileInputStream extends FileInputStream {

	private File file;

	public DeleteOnCloseFileInputStream( final File file ) throws FileNotFoundException {
		super( file );
		this.file = file;
	}

	@Override
	public void close() throws IOException {
		try {
			super.close();
		} finally {
			if ( file != null ) {
				file.delete();
				file = null;
			}
		}
	}

}

@@ -138,16 +138,57 @@
 ption;%0A%0A
+import org.apache.commons.io.FileUtils;%0A%0A
 /*%0A * Ta
@@ -314,16 +314,22 @@
 private 
+final 
 File fil
@@ -560,77 +560,45 @@
 %0A%09%09%09
-if ( file != null ) %7B%0A%09%09%09%09file.delete();%0A%09%09%09%09file = null;%0A%09%09%09%7D
+FileUtils.forceDelete( file );
 %0A%09%09%7D%0A%09%7D%0A
 %0A%7D%0A
@@ -594,11 +594,10 @@
 %0A%09%09%7D%0A%09%7D%0A
-%0A
 %7D%0A

Fix file.delete ignored return value