While searching the root cause for https://github.com/spring-cloud/spring-cloud-config/issues/1572 I reviewed OriginTrackedYamlLoader. In cases of an empty list or empty map there is no origin created.
Reproduction
Add to https://raw.githubusercontent.com/spring-projects/spring-boot/master/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-yaml.yml
emptylist: []
emptymap: {}
and extend testcases for emptylist and emptymap.
Fix
Add additional code for CollectionNodes which are empty In OriginTrackedYamlLoader.constructObject between ScalarNode and MappingNode check.
} else if (node instanceof CollectionNode && ((CollectionNode<?>) node).getValue().isEmpty()) {
return constructTrackedObject(node, super.constructObject(node));
}
Closing in favor of PR #21704.
It seems that @mbhave intended to close this.
Thanks.
Most helpful comment
It seems that @mbhave intended to close this.