Skip to content

Commit 8ec6c37

Browse files
committed
Do not expand ElementsParser until size equals storage length
Previously, ElementsParser would expand its internal storage when the size of the storage was <= the end index of the element being parsed, irrespective of how many elements had been stored. This led to expansion of the storage, even for a source that contains a single element, if the end of the element was at an index greater than the size of the storage. This commit updates ElementsParser to resize its storage when the size (the number of elements that have been stored) is equal to the size of the storage. See gh-15760
1 parent 2956b86 commit 8ec6c37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ private void add(int start, int end, ElementType type,
798798
if ((end - start) < 1 || type == ElementType.EMPTY) {
799799
return;
800800
}
801-
if (this.start.length <= end) {
801+
if (this.start.length == this.size) {
802802
this.start = expand(this.start);
803803
this.end = expand(this.end);
804804
this.type = expand(this.type);

0 commit comments

Comments
 (0)