Keep YAML entries that haven an empty array value

Prior to this commit, a YAML entry that define an empty array value was
lost. This commit makes sure to flag it with an empty String, which
corresponds as an empty comma separated list of entries in the
properties format.

Issue: SPR-16769
This commit is contained in:
Stephane Nicoll
2018-04-29 10:29:47 +02:00
parent 6c6e44b58e
commit 43f2334e82
3 changed files with 34 additions and 6 deletions

View File

@@ -293,10 +293,14 @@ public abstract class YamlProcessor {
// Need a compound key
@SuppressWarnings("unchecked")
Collection<Object> collection = (Collection<Object>) value;
int count = 0;
for (Object object : collection) {
buildFlattenedMap(result,
Collections.singletonMap("[" + (count++) + "]", object), key);
if (collection.isEmpty()) {
result.put(key, "");
} else {
int count = 0;
for (Object object : collection) {
buildFlattenedMap(result, Collections.singletonMap(
"[" + (count++) + "]", object), key);
}
}
}
else {