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

vy pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new 72bf5bd  Fix NPE in DefaultRolloverStrategy. (#755)
72bf5bd is described below

commit 72bf5bda03c99ec052a81b501f64bbeb5229b334
Author: Volkan Yazici <[email protected]>
AuthorDate: Wed Feb 16 12:42:24 2022 +0100

    Fix NPE in DefaultRolloverStrategy. (#755)
---
 .../logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
index d747c83..ee61cf2 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
@@ -141,7 +141,8 @@ public class DefaultRolloverStrategy extends 
AbstractRolloverStrategy {
                     }
                 }
             }
-            final int compressionLevel = 
Integers.parseInt(compressionLevelStr.trim(), Deflater.DEFAULT_COMPRESSION);
+            final String trimmedCompressionLevelStr = compressionLevelStr != 
null ? compressionLevelStr.trim() : compressionLevelStr;
+            final int compressionLevel = 
Integers.parseInt(trimmedCompressionLevelStr, Deflater.DEFAULT_COMPRESSION);
             // The config object can be null when this object is built 
programmatically.
             final StrSubstitutor nonNullStrSubstitutor = config != null ? 
config.getStrSubstitutor() : new StrSubstitutor();
                        return new DefaultRolloverStrategy(minIndex, maxIndex, 
useMax, compressionLevel, nonNullStrSubstitutor,

Reply via email to