Fix fileChannel not closed, preventing delete to occur correctly

This commit is contained in:
Frederic Bregier 2014-01-23 13:21:59 +01:00 committed by Trustin Lee
parent f0c7c901d0
commit 2249437225

View File

@ -225,6 +225,14 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
@Override @Override
public void delete() { public void delete() {
if (fileChannel != null) {
try {
fileChannel.force(false);
fileChannel.close();
} catch (IOException e) { //ignore
}
fileChannel = null;
}
if (! isRenamed) { if (! isRenamed) {
if (file != null && file.exists()) { if (file != null && file.exists()) {
file.delete(); file.delete();