package de.retest.recheck.util;

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

import org.apache.commons.io.FileUtils;

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

	private final File file;

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

	@Override
	public void close() throws IOException {
		try {
			super.close();
		} finally {
			FileUtils.forceDelete( file );
		}
	}
}

@@ -187,16 +187,51 @@
 Utils;%0A%0A
+import lombok.extern.slf4j.Slf4j;%0A%0A
 /*%0A * Ta
@@ -279,16 +279,23 @@
 155%0A */%0A
+@Slf4j%0A
 public c
@@ -603,16 +603,43 @@
 nally %7B%0A
+%09%09%09if ( file.exists() ) %7B%0A%09
 %09%09%09FileU
@@ -664,16 +664,95 @@
 file );%0A
+%09%09%09%7D else %7B%0A%09%09%09%09log.debug( %22File '%7B%7D' has already been deleted.%22, file );%0A%09%09%09%7D%0A
 %09%09%7D%0A%09%7D%0A%7D

Apply fix