CAMEL-10791-review adjustment
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/06e0527c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/06e0527c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/06e0527c Branch: refs/heads/master Commit: 06e0527c2a024bacd617af0b3fbe111018dbda08 Parents: 928cdb1 Author: onders86 <ondersez...@gmail.com> Authored: Tue Mar 14 07:55:26 2017 +0300 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Mar 14 18:29:38 2017 +0100 ---------------------------------------------------------------------- .../zipfile/ZipFileDataFormatTest.java | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/06e0527c/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java ---------------------------------------------------------------------- diff --git a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java index 6afac67..caf71dc 100644 --- a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java +++ b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java @@ -120,7 +120,7 @@ public class ZipFileDataFormatTest extends CamelTestSupport { zip.setSupportEmptyDirectory(true); template.sendBody("direct:unzipWithEmptyDirectory", new File("src/test/resources/hello.odt")); assertTrue(Files.exists(Paths.get("hello_out/Configurations2"))); - //deleteDirectory(new File("hello_out")); + deleteDirectory(new File("hello_out")); } @Test @@ -130,7 +130,7 @@ public class ZipFileDataFormatTest extends CamelTestSupport { zip.setSupportEmptyDirectory(false); template.sendBody("direct:unzipWithEmptyDirectory", new File("src/test/resources/hello.odt")); assertTrue(!Files.exists(Paths.get("hello_out/Configurations2"))); - //deleteDirectory(new File("hello_out")); + deleteDirectory(new File("hello_out")); } @Test @@ -229,21 +229,15 @@ public class ZipFileDataFormatTest extends CamelTestSupport { } } - private static void copy(File file, OutputStream out) throws IOException { - InputStream in = new FileInputStream(file); - try { - copy(in, out); - } finally { - in.close(); - } + private static void copy(File file, OutputStream out) throws IOException { + try (InputStream in = new FileInputStream(file)) { + copy(in, out); + } } - private static void copy(InputStream in, File file) throws IOException { - OutputStream out = new FileOutputStream(file); - try { - copy(in, out); - } finally { - out.close(); + private static void copy(InputStream in, File file) throws IOException { + try (OutputStream out = new FileOutputStream(file)) { + copy(in, out); } }