This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/2.x by this push:
new f0bd87818d Discard blank keys in `PropertiesUtil`
f0bd87818d is described below
commit f0bd87818d43efa8337f56526ced2020c308d9bf
Author: Volkan Yazıcı <[email protected]>
AuthorDate: Tue Apr 23 12:08:07 2024 +0200
Discard blank keys in `PropertiesUtil`
---
.../main/java/org/apache/logging/log4j/util/PropertiesUtil.java | 2 +-
src/changelog/.2.x.x/2414_fix_blank_keys_in_PropertiesUtil.xml | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git
a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index 58a04fb09e..d3fd0952d9 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -536,7 +536,7 @@ public final class PropertiesUtil {
final Set<String> keys = new HashSet<>();
sources.stream().map(PropertySource::getPropertyNames).forEach(keys::addAll);
// 2. Fills the property caches. Sources with higher priority
values don't override the previous ones.
- keys.stream().filter(Objects::nonNull).forEach(key -> {
+ keys.stream().filter(Strings::isNotBlank).forEach(key -> {
final List<CharSequence> tokens =
PropertySource.Util.tokenize(key);
final boolean hasTokens = !tokens.isEmpty();
sources.forEach(source -> {
diff --git a/src/changelog/.2.x.x/2414_fix_blank_keys_in_PropertiesUtil.xml
b/src/changelog/.2.x.x/2414_fix_blank_keys_in_PropertiesUtil.xml
new file mode 100644
index 0000000000..a94f7e41c0
--- /dev/null
+++ b/src/changelog/.2.x.x/2414_fix_blank_keys_in_PropertiesUtil.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="https://logging.apache.org/xml/ns"
+ xsi:schemaLocation="https://logging.apache.org/xml/ns
https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
+ type="fixed">
+ <issue id="2414"
link="https://github.com/apache/logging-log4j2/issues/2414"/>
+ <description format="asciidoc">Discard blank keys in
`PropertiesUtil`</description>
+</entry>