diff options
author | Dominik Stadler <centic@apache.org> | 2015-12-22 22:35:59 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-12-22 22:35:59 +0000 |
commit | 83eb1aaefcdc8cca48677ab95f64c1eb4ff04850 (patch) | |
tree | 1ab9cde44c16048fea9d44a20ad583b0166f0126 /src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java | |
parent | 70d75027d3013e0e812b8fa746026fae3dcdb04e (diff) | |
download | poi-83eb1aaefcdc8cca48677ab95f64c1eb4ff04850.tar.gz poi-83eb1aaefcdc8cca48677ab95f64c1eb4ff04850.zip |
Fix freeing resources in some tests and dev-tools so we can run unit-tests with enabled file-leak-detector
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1721468 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java index 0463162daf..15a8954888 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java @@ -48,15 +48,18 @@ public class TestBiffViewer extends BaseXLSIteratingTest { @Override void runOneFile(File fileIn) throws IOException { NPOIFSFileSystem fs = new NPOIFSFileSystem(fileIn, true); - InputStream is = BiffViewer.getPOIFSInputStream(fs); - try { - // use a NullOutputStream to not write the bytes anywhere for best runtime - PrintWriter dummy = new PrintWriter(new OutputStreamWriter(NULL_OUTPUT_STREAM, LocaleUtil.CHARSET_1252)); - BiffViewer.runBiffViewer(dummy, is, true, true, true, false); - } finally { - is.close(); - fs.close(); - } + try { + InputStream is = BiffViewer.getPOIFSInputStream(fs); + try { + // use a NullOutputStream to not write the bytes anywhere for best runtime + PrintWriter dummy = new PrintWriter(new OutputStreamWriter(NULL_OUTPUT_STREAM, LocaleUtil.CHARSET_1252)); + BiffViewer.runBiffViewer(dummy, is, true, true, true, false); + } finally { + is.close(); + } + } finally { + fs.close(); + } } // @Test |