aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src/main
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-11-11 13:24:37 +0000
committerPJ Fanning <fanningpj@apache.org>2021-11-11 13:24:37 +0000
commit530af684b3ae51b464c2e8a2a4633c72eaeade66 (patch)
tree5034f54b660775d8f4adebaa3e61aa77b3a3fb9f /poi-ooxml/src/main
parent66461e1e68cb6bce0b16dbbd9ed874f023c77a4d (diff)
downloadpoi-530af684b3ae51b464c2e8a2a4633c72eaeade66.tar.gz
poi-530af684b3ae51b464c2e8a2a4633c72eaeade66.zip
try to handle logging issue where DeferredSXSSFWorkbook close can lead to logging about close already having been called
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894951 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src/main')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/StreamingSheetWriter.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/StreamingSheetWriter.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/StreamingSheetWriter.java
index 173e6963bd..1e467244f5 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/StreamingSheetWriter.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/StreamingSheetWriter.java
@@ -37,6 +37,7 @@ import org.apache.poi.util.Beta;
@Beta
public class StreamingSheetWriter extends SheetDataWriter {
private static final Logger LOG = LogManager.getLogger(StreamingSheetWriter.class);
+ private boolean closed = false;
public StreamingSheetWriter() throws IOException {
throw new RuntimeException("StreamingSheetWriter requires OutputStream");
@@ -68,7 +69,9 @@ public class StreamingSheetWriter extends SheetDataWriter {
@Override
public void close() throws IOException {
- _out.flush();
+ if (!closed) {
+ _out.flush();
+ }
}
@Override
@@ -78,7 +81,10 @@ public class StreamingSheetWriter extends SheetDataWriter {
@Override
boolean dispose() throws IOException {
- _out.close();
+ if (!closed) {
+ _out.close();
+ }
+ closed = true;
return true;
}
}