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 e4439a8f Fixes CONFIGURATION-849 (#569)
e4439a8f is described below

commit e4439a8f90c8e702386f4094db206b89c2cf7455
Author: Willy van Diepen <97896278+wvdie...@users.noreply.github.com>
AuthorDate: Sat May 10 18:50:02 2025 +0200

    Fixes CONFIGURATION-849 (#569)
---
 .../configuration2/convert/AbstractListDelimiterHandler.java      | 2 +-
 .../org/apache/commons/configuration2/TestYAMLConfiguration.java  | 8 +++++++-
 src/test/resources/test.yaml                                      | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/configuration2/convert/AbstractListDelimiterHandler.java
 
b/src/main/java/org/apache/commons/configuration2/convert/AbstractListDelimiterHandler.java
index 6af2e8de..60dcafbb 100644
--- 
a/src/main/java/org/apache/commons/configuration2/convert/AbstractListDelimiterHandler.java
+++ 
b/src/main/java/org/apache/commons/configuration2/convert/AbstractListDelimiterHandler.java
@@ -40,10 +40,10 @@ import java.util.Set;
 public abstract class AbstractListDelimiterHandler implements 
ListDelimiterHandler {
 
     static Collection<?> flatten(final ListDelimiterHandler handler, final 
Object value, final int limit, final Set<Object> dejaVu) {
-        dejaVu.add(value);
         if (value instanceof String) {
             return handler.split((String) value, true);
         }
+        dejaVu.add(value);
         final Collection<Object> result = new LinkedList<>();
         if (value instanceof Path) {
             // Don't handle as an Iterable.
diff --git 
a/src/test/java/org/apache/commons/configuration2/TestYAMLConfiguration.java 
b/src/test/java/org/apache/commons/configuration2/TestYAMLConfiguration.java
index ea8bd7f0..c39e3b18 100644
--- a/src/test/java/org/apache/commons/configuration2/TestYAMLConfiguration.java
+++ b/src/test/java/org/apache/commons/configuration2/TestYAMLConfiguration.java
@@ -109,6 +109,12 @@ public class TestYAMLConfiguration {
         assertEquals(Arrays.asList("nested1", "nested2", "nested3"), property);
     }
 
+    @Test
+    public void testDoubleStringValues() {
+        final Object property = yamlConfiguration.getProperty("key5.example");
+        assertEquals(Arrays.asList("", "", "value"), property);
+    }
+
     @Test
     public void testObjectCreationFromReader() {
         final File createdFile = new File(tempFolder, "data.txt");
@@ -138,7 +144,7 @@ public class TestYAMLConfiguration {
 
         // ..and then try parsing it back as using SnakeYAML
         final Map<?, ?> parsed = new Yaml().loadAs(output, Map.class);
-        assertEquals(6, parsed.entrySet().size());
+        assertEquals(7, parsed.entrySet().size());
         assertEquals("value1", parsed.get("key1"));
 
         final Map<?, ?> key2 = (Map<?, ?>) parsed.get("key2");
diff --git a/src/test/resources/test.yaml b/src/test/resources/test.yaml
index 315e4a37..6052e50a 100644
--- a/src/test/resources/test.yaml
+++ b/src/test/resources/test.yaml
@@ -23,4 +23,7 @@ int1:
 martin:
     name: Martin D'vloper
     job: Developer
-    skill: Elite
\ No newline at end of file
+    skill: Elite
+
+key5:
+  example: [ '', '', value]
\ No newline at end of file

Reply via email to