aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/poifs/nio/TestDataSource.java
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2019-12-15 14:53:11 +0000
committerDominik Stadler <centic@apache.org>2019-12-15 14:53:11 +0000
commit1a5cec89d8d36f2a7cd5643b221befd57fa515b7 (patch)
tree6a6719f33761c08a719599393ca310eafcb7834e /src/testcases/org/apache/poi/poifs/nio/TestDataSource.java
parent2748844549b50dc11e8ef19dcd506c820c1a1e19 (diff)
downloadpoi-1a5cec89d8d36f2a7cd5643b221befd57fa515b7.tar.gz
poi-1a5cec89d8d36f2a7cd5643b221befd57fa515b7.zip
Replace manual close with try-with-resources
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1871590 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/poifs/nio/TestDataSource.java')
-rw-r--r--src/testcases/org/apache/poi/poifs/nio/TestDataSource.java16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/testcases/org/apache/poi/poifs/nio/TestDataSource.java b/src/testcases/org/apache/poi/poifs/nio/TestDataSource.java
index 1bc3f4532e..4b3932bad1 100644
--- a/src/testcases/org/apache/poi/poifs/nio/TestDataSource.java
+++ b/src/testcases/org/apache/poi/poifs/nio/TestDataSource.java
@@ -116,17 +116,11 @@ public class TestDataSource extends TestCase
}
private void writeDataToFile(File temp) throws IOException {
- OutputStream str = new FileOutputStream(temp);
- try {
- InputStream in = data.openResourceAsStream("Notes.ole2");
- try {
- IOUtils.copy(in, str);
- } finally {
- in.close();
- }
- } finally {
- str.close();
- }
+ try (OutputStream str = new FileOutputStream(temp)) {
+ try (InputStream in = data.openResourceAsStream("Notes.ole2")) {
+ IOUtils.copy(in, str);
+ }
+ }
}
private void checkDataSource(FileBackedDataSource ds, boolean writeable) throws IOException {