mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
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
This commit is contained in:
parent
66461e1e68
commit
530af684b3
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user