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 00f15a07ac2808dee36f9dfabf62a5e62ab4eee2
Author: Marcus Hoja <[email protected]>
AuthorDate: Wed Feb 16 10:55:22 2022 +0100

    Trim MaxBackupIndex if last char is blank. (#755)
    
    `log4j.properties` containing `MaxBackupIndex` with trailing whitespace
    causes `log4j-1.2-bridge` to fail silently due to `NumberFormatException`.
---
 .../logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java    | 2 +-
 1 file changed, 1 insertion(+), 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 0facba8..d90e6de 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
@@ -132,7 +132,7 @@ public class DefaultRolloverStrategy extends 
AbstractRolloverStrategy {
                 }
                 maxIndex = DEFAULT_WINDOW_SIZE;
                 if (max != null) {
-                    maxIndex = Integer.parseInt(max);
+                    maxIndex = Integer.parseInt(max.trim());
                     if (maxIndex < minIndex) {
                         maxIndex = minIndex < DEFAULT_WINDOW_SIZE ? 
DEFAULT_WINDOW_SIZE : minIndex;
                         LOGGER.error("Maximum window size must be greater than 
the minimum windows size. Set to " + maxIndex);

Reply via email to