Skip to content

Commit b7d4f72

Browse files
committed
try-with-resources.
1 parent 20a316e commit b7d4f72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderCronTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ public void testAppender() throws Exception {
8181
fail("No compressed files found");
8282
}
8383
final Path src = FileSystems.getDefault().getPath("target/test-classes/log4j-rolling-cron2.xml");
84-
final OutputStream os = new FileOutputStream("target/test-classes/log4j-rolling-cron.xml");
85-
Files.copy(src, os);
86-
os.close();
84+
try (final OutputStream os = new FileOutputStream("target/test-classes/log4j-rolling-cron.xml")) {
85+
Files.copy(src, os);
86+
}
8787
Thread.sleep(5000);
8888
// force a reconfiguration
8989
for (int i = 0; i < MAX_TRIES; ++i) {

0 commit comments

Comments
 (0)