This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch LoggerContextProperties
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit eb612157923428f258521257d0a52bfaca32da84
Author: Michael Ernst <[email protected]>
AuthorDate: Tue Apr 11 01:06:35 2023 -0700

    Ensure `FileOutputStream` is closed in `CommonsCompressAction.execute()` 
(#1415)
---
 .../log4j/core/appender/rolling/action/CommonsCompressAction.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java
index e461a8c5a6..eedc6c9ade 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/CommonsCompressAction.java
@@ -104,9 +104,9 @@ public final class CommonsCompressAction extends 
AbstractAction {
         }
         LOGGER.debug("Starting {} compression of {}", name, source.getPath() );
         try (final FileInputStream input = new FileInputStream(source);
+             final FileOutputStream fileOutput = new 
FileOutputStream(destination);
                 final BufferedOutputStream output = new BufferedOutputStream(
-                        new 
CompressorStreamFactory().createCompressorOutputStream(name, new 
FileOutputStream(
-                                destination)))) {
+                        new 
CompressorStreamFactory().createCompressorOutputStream(name, fileOutput))) {
             IOUtils.copy(input, output, BUF_SIZE);
             LOGGER.debug("Finished {} compression of {}", name, 
source.getPath() );
         } catch (final CompressorException e) {

Reply via email to