From 3a44eba6a21ce17a36d67f214b08e55617c29db6 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 7418d7b9ad..014fc189be 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; } } -- 2.39.5