Repository: logging-log4j2 Updated Branches: refs/heads/master 098ce0ff3 -> bc3cd34b5
Use try-with-resources. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/bc3cd34b Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/bc3cd34b Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/bc3cd34b Branch: refs/heads/master Commit: bc3cd34b57d2830db80dd493e923de9cd9a47401 Parents: 098ce0f Author: ggregory <[email protected]> Authored: Sat Jan 16 20:54:35 2016 -0800 Committer: ggregory <[email protected]> Committed: Sat Jan 16 20:54:35 2016 -0800 ---------------------------------------------------------------------- .../log4j/core/impl/Log4jLogEventNanoTimeTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bc3cd34b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java index b159feb..b4d37dd 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java @@ -65,12 +65,14 @@ public class Log4jLogEventNanoTimeTest { CoreLoggerContexts.stopLoggerContext(file); // stop async thread - final BufferedReader reader = new BufferedReader(new FileReader(file)); - final String line1 = reader.readLine(); - final String line2 = reader.readLine(); - // System.out.println(line1); - // System.out.println(line2); - reader.close(); + String line1; + String line2; + try (final BufferedReader reader = new BufferedReader(new FileReader(file))) { + line1 = reader.readLine(); + line2 = reader.readLine(); + // System.out.println(line1); + // System.out.println(line2); + } file.delete(); assertNotNull("line1", line1);
