This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-configuration.git
The following commit(s) were added to refs/heads/master by this push: new ccf97a5d Refactor magic strings ccf97a5d is described below commit ccf97a5d4dd895523bda029d8a56c403f146ab91 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Apr 23 18:41:46 2024 -0400 Refactor magic strings --- .../java/org/apache/commons/configuration2/INIConfiguration.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/configuration2/INIConfiguration.java b/src/main/java/org/apache/commons/configuration2/INIConfiguration.java index 53fbe77e..ee771c94 100644 --- a/src/main/java/org/apache/commons/configuration2/INIConfiguration.java +++ b/src/main/java/org/apache/commons/configuration2/INIConfiguration.java @@ -203,6 +203,8 @@ import org.apache.commons.configuration2.tree.TrackedNodeModel; */ public class INIConfiguration extends BaseHierarchicalConfiguration implements FileBasedConfiguration { + private static final String EMPTY_KEY = " "; + /** * Builds instances of INIConfiguration. * @@ -501,7 +503,7 @@ public class INIConfiguration extends BaseHierarchicalConfiguration implements F String section = line.substring(1, length); if (section.isEmpty()) { // use space for sections with no key - section = " "; + section = EMPTY_KEY; } sectionBuilder = sectionBuilders.computeIfAbsent(section, k -> new ImmutableNode.Builder()); } else { @@ -517,7 +519,7 @@ public class INIConfiguration extends BaseHierarchicalConfiguration implements F key = key.trim(); if (key.isEmpty()) { // use space for properties with no key - key = " "; + key = EMPTY_KEY; } createValueNodes(sectionBuilder, key, value); }