From ecf7db32233e1ab54dba1ebc162384a91771d674 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Tue, 12 Apr 2016 18:48:31 +0000 Subject: [PATCH] bug 59312: delete temporary files even when the output stream cannot be closed (such as out of disk space IOException) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1738848 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xssf/streaming/SheetDataWriter.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java index 7418d7b9a..014fc189b 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java @@ -375,7 +375,12 @@ public class SheetDataWriter { * @return true if the file was deleted, false if it wasn't. */ boolean dispose() throws IOException { - _out.close(); - return _fd.delete(); + final boolean ret; + try { + _out.close(); + } finally { + ret = _fd.delete(); + } + return ret; } }