From 8bb0a131a7ec606e1c6c2ac9d7071de5ab461ae7 Mon Sep 17 00:00:00 2001 From: Frederic Bregier Date: Thu, 23 Jan 2014 13:23:27 +0100 Subject: [PATCH] Fix fileChannel not closed, preventing delete to occur correctly --- .../codec/http/multipart/AbstractDiskHttpData.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/multipart/AbstractDiskHttpData.java b/src/main/java/org/jboss/netty/handler/codec/http/multipart/AbstractDiskHttpData.java index d2d56ab340..99ee6b1bbd 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/multipart/AbstractDiskHttpData.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/multipart/AbstractDiskHttpData.java @@ -210,6 +210,14 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData { } public void delete() { + if (fileChannel != null) { + try { + fileChannel.force(false); + fileChannel.close(); + } catch (IOException e) { //ignore + } + fileChannel = null; + } if (! isRenamed) { if (file != null && file.exists()) { file.delete();