commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [2/2] commons-io git commit: FileWriterWithEncodingTest: simplify setUp method
Date Thu, 28 Sep 2017 19:08:06 GMT
FileWriterWithEncodingTest: simplify setUp method


Project: http://git-wip-us.apache.org/repos/asf/commons-io/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-io/commit/36940b64
Tree: http://git-wip-us.apache.org/repos/asf/commons-io/tree/36940b64
Diff: http://git-wip-us.apache.org/repos/asf/commons-io/diff/36940b64

Branch: refs/heads/master
Commit: 36940b6418283806ed10292776c9c4269923e1ca
Parents: 2341c40
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Thu Sep 28 21:07:41 2017 +0200
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Thu Sep 28 21:07:41 2017 +0200

----------------------------------------------------------------------
 .../commons/io/output/FileWriterWithEncodingTest.java     | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-io/blob/36940b64/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java b/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java
index c50dd63..54c00f7 100644
--- a/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java
+++ b/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java
@@ -56,16 +56,10 @@ public class FileWriterWithEncodingTest {
     private final char[] anotherTestContent = new char[]{'f', 'z', 'x'};
 
     @Before
-    public void setUp() {
+    public void setUp() throws Exception {
         final File encodingFinder = new File(getTestDirectory(), "finder.txt");
-        OutputStreamWriter out = null;
-        try {
-            out = new OutputStreamWriter(new FileOutputStream(encodingFinder));
+        try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(encodingFinder)))
{
             defaultEncoding = out.getEncoding();
-        } catch (final IOException ex) {
-            throw new RuntimeException(ex.getMessage());
-        } finally {
-            IOUtils.closeQuietly(out);
         }
         file1 = new File(getTestDirectory(), "testfile1.txt");
         file2 = new File(getTestDirectory(), "testfile2.txt");


Mime
View raw message