From ae494ff2ef190a34f3efd73b9ddcd00b37f116d2 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 9 Apr 2025 21:30:50 +0000 Subject: [PATCH] [bug-69646] check for null _fd instance in dispose call git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1924978 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/streaming/StreamingSheetWriter.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 382eb114dd..1398c57abc 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 @@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets; import org.apache.logging.log4j.Logger; import org.apache.poi.logging.PoiLogManager; import org.apache.poi.util.Beta; +import org.apache.poi.util.Removal; /** * Unlike SheetDataWriter, this writer does not create a temporary file, it writes data directly @@ -40,6 +41,11 @@ public class StreamingSheetWriter extends SheetDataWriter { private static final Logger LOG = PoiLogManager.getLogger(StreamingSheetWriter.class); private boolean closed = false; + /** + * @throws IOException always thrown, use the constructor with an OutputStream + * @deprecated use {@link #StreamingSheetWriter(OutputStream)} + */ + @Removal(version = "6.0.0") public StreamingSheetWriter() throws IOException { throw new IllegalStateException("StreamingSheetWriter requires OutputStream"); } @@ -49,11 +55,17 @@ public class StreamingSheetWriter extends SheetDataWriter { LOG.atDebug().log("Preparing SXSSF sheet writer"); } + /** + * @throws IllegalStateException always thrown - not supported + */ @Override public File createTempFile() throws IOException { throw new IllegalStateException("Not supported with StreamingSheetWriter"); } + /** + * @throws IllegalStateException always thrown - not supported + */ @Override public Writer createWriter(File fd) throws IOException { throw new IllegalStateException("Not supported with StreamingSheetWriter"); @@ -75,6 +87,9 @@ public class StreamingSheetWriter extends SheetDataWriter { } } + /** + * @throws IllegalStateException always thrown - not supported + */ @Override public InputStream getWorksheetXMLInputStream() throws IOException { throw new IllegalStateException("Not supported with StreamingSheetWriter");