From e0c8416726efa9ca12e0791aa89295c9e7964cde Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 23 Nov 2017 20:03:25 +0000 Subject: use try with resources in examples git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1816189 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java') diff --git a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java index e3ac6d22a1..b4f2024a24 100644 --- a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java +++ b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java @@ -87,14 +87,10 @@ public class XSSFBReader extends XSSFReader { * @throws IOException when there's a problem with the workbook part's stream */ public String getAbsPathMetadata() throws IOException { - InputStream is = null; - try { - is = workbookPart.getInputStream(); - PathExtractor p = new PathExtractor(workbookPart.getInputStream()); + try (InputStream is = workbookPart.getInputStream()) { + PathExtractor p = new PathExtractor(is); p.parse(); return p.getPath(); - } finally { - IOUtils.closeQuietly(is); } } -- cgit v1.2.3