From: Dominik Stadler Date: Fri, 7 Nov 2014 22:33:35 +0000 (+0000) Subject: Slowly start to adjust places in tests where we do not properly close file handles X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=62ac7efea6eb45a1ab6816d047965ff176f6a26f;p=poi.git Slowly start to adjust places in tests where we do not properly close file handles git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1637474 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/XWPFTestDataSamples.java b/src/ooxml/testcases/org/apache/poi/xwpf/XWPFTestDataSamples.java index 4270778887..d7f2222404 100644 --- a/src/ooxml/testcases/org/apache/poi/xwpf/XWPFTestDataSamples.java +++ b/src/ooxml/testcases/org/apache/poi/xwpf/XWPFTestDataSamples.java @@ -44,7 +44,10 @@ public class XWPFTestDataSamples { public static byte[] getImage(String filename) throws IOException { InputStream is = POIDataSamples.getDocumentInstance().openResourceAsStream(filename); - byte[] result = IOUtils.toByteArray(is); - return result; + try { + return IOUtils.toByteArray(is); + } finally { + is.close(); + } } }