From d4373c2d098030e885aa33d799056b95aa42d7f1 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 26 Oct 2023 15:02:52 +0000 Subject: try to close streams in HSSF tests git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913351 13f79535-47bb-0310-9956-ffa450edef68 --- poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'poi') diff --git a/poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java b/poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java index e85ff044ab..32fdc0fc52 100644 --- a/poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java +++ b/poi/src/test/java/org/apache/poi/hssf/HSSFTestDataSamples.java @@ -43,8 +43,8 @@ public final class HSSFTestDataSamples { } public static HSSFWorkbook openSampleWorkbook(String sampleFileName) { - try { - return new HSSFWorkbook(_inst.openResourceAsStream(sampleFileName)); + try (InputStream stream = _inst.openResourceAsStream(sampleFileName)){ + return new HSSFWorkbook(stream); } catch (IOException e) { throw new RuntimeException(e); } -- cgit v1.2.3