mirror of https://github.com/apache/poi.git
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,8 +69,10 @@ public class StreamingSheetWriter extends SheetDataWriter {
|
|||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
if (!closed) {
|
||||
_out.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getWorksheetXMLInputStream() throws IOException {
|
||||
|
@ -78,7 +81,10 @@ public class StreamingSheetWriter extends SheetDataWriter {
|
|||
|
||||
@Override
|
||||
boolean dispose() throws IOException {
|
||||
if (!closed) {
|
||||
_out.close();
|
||||
}
|
||||
closed = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue