Fix try to delete file while it does not exist anymore (see #2102 and #1713) in reference to this issue
This commit is contained in:
parent
ed8ee33661
commit
da5da8e212
@ -226,9 +226,10 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
|
||||
@Override
|
||||
public void delete() {
|
||||
if (! isRenamed) {
|
||||
if (file != null) {
|
||||
if (file != null && file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
file = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,6 +309,9 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
|
||||
if (dest == null) {
|
||||
throw new NullPointerException("dest");
|
||||
}
|
||||
if (file == null) {
|
||||
throw new IOException("No file defined so cannot be renamed");
|
||||
}
|
||||
if (!file.renameTo(dest)) {
|
||||
// must copy
|
||||
FileInputStream inputStream = new FileInputStream(file);
|
||||
|
Loading…
Reference in New Issue
Block a user