You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/03/25 07:56:14 UTC
(logging-log4j2) 03/06: Fix issue 2380: Log messages with insufficient parameters should not throw exception.Add test cases.
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 76e1acc5d1334b0ad78aa9d604d34489750446d5
Author: PanLongfei <24...@qq.com>
AuthorDate: Fri Mar 22 09:49:49 2024 +0800
Fix issue 2380: Log messages with insufficient parameters should not throw exception.Add test cases.
---
.../org/apache/logging/log4j/message/ParameterFormatterTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/log4j-api-test/src/test/java/org/apache/logging/log4j/message/ParameterFormatterTest.java b/log4j-api-test/src/test/java/org/apache/logging/log4j/message/ParameterFormatterTest.java
index 164aedf2ec..638ab5c0dd 100644
--- a/log4j-api-test/src/test/java/org/apache/logging/log4j/message/ParameterFormatterTest.java
+++ b/log4j-api-test/src/test/java/org/apache/logging/log4j/message/ParameterFormatterTest.java
@@ -78,10 +78,10 @@ class ParameterFormatterTest {
}
@ParameterizedTest
- @CsvSource({"2,pan {} {},a,pan a {}", "3,pan {}{}{},a-b,pan ab{}", "1,pan {},a-b-c,pan a"})
- void format_should_fail_on_insufficient_args(
+ @CsvSource({"2,pan {} {},a,pan a {}", "3,pan {}{}{},a b,pan ab{}", "1,pan {},a b c,pan a"})
+ void format_should_warn_on_insufficient_args(
final int placeholderCount, final String pattern, final String argsStr, final String expectedMessage) {
- final String[] args = argsStr.split("-");
+ final String[] args = argsStr.split(" ");
final int argCount = args.length;
String actualMessage = ParameterFormatter.format(pattern, args, argCount);