Merge branch '3.0.x'

Closes gh-35367
pull/35368/head
Moritz Halbritter 2 years ago
commit 0f1870ee98

@ -67,6 +67,7 @@ class OriginTrackedYamlLoader extends YamlProcessor {
loaderOptions.setAllowDuplicateKeys(false); loaderOptions.setAllowDuplicateKeys(false);
loaderOptions.setMaxAliasesForCollections(Integer.MAX_VALUE); loaderOptions.setMaxAliasesForCollections(Integer.MAX_VALUE);
loaderOptions.setAllowRecursiveKeys(true); loaderOptions.setAllowRecursiveKeys(true);
loaderOptions.setCodePointLimit(Integer.MAX_VALUE);
return createYaml(loaderOptions); return createYaml(loaderOptions);
} }

@ -182,6 +182,18 @@ class OriginTrackedYamlLoaderTests {
assertThat(loaded.get("some.anotherpath.config.key")).hasToString("value"); assertThat(loaded.get("some.anotherpath.config.key")).hasToString("value");
} }
@Test
void canLoadFilesBiggerThan3Mb() {
StringBuilder yaml = new StringBuilder();
while (yaml.length() < 4_194_304) {
yaml.append("- some list entry\n");
}
Resource resource = new ByteArrayResource(yaml.toString().getBytes(StandardCharsets.UTF_8));
this.loader = new OriginTrackedYamlLoader(resource);
Map<String, Object> loaded = this.loader.load().get(0);
assertThat(loaded).isNotEmpty();
}
private OriginTrackedValue getValue(String name) { private OriginTrackedValue getValue(String name) {
if (this.result == null) { if (this.result == null) {
this.result = this.loader.load(); this.result = this.loader.load();

Loading…
Cancel
Save