This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 485e489658fa2725de8e48e055a491270d514ede Author: Volkan Yazici <[email protected]> AuthorDate: Wed Feb 16 10:59:11 2022 +0100 Trim input to Integer.parseInt() in DefaultRolloverStrategy. (#755) --- .../logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d90e6de..d606756 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 @@ -124,7 +124,7 @@ public class DefaultRolloverStrategy extends AbstractRolloverStrategy { useMax = fileIndex == null || fileIndex.equalsIgnoreCase("max"); minIndex = MIN_WINDOW_SIZE; if (min != null) { - minIndex = Integer.parseInt(min); + minIndex = Integer.parseInt(min.trim()); if (minIndex < 1) { LOGGER.error("Minimum window size too small. Limited to " + MIN_WINDOW_SIZE); minIndex = MIN_WINDOW_SIZE; @@ -139,7 +139,7 @@ public class DefaultRolloverStrategy extends AbstractRolloverStrategy { } } } - final int compressionLevel = Integers.parseInt(compressionLevelStr, Deflater.DEFAULT_COMPRESSION); + final int compressionLevel = Integers.parseInt(compressionLevelStr.trim(), 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,
