From 8ec6c372e4333c1e3529b77a723e5d5946a0b7b7 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 23 Jan 2019 14:09:03 +0000 Subject: [PATCH] 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 --- .../context/properties/source/ConfigurationPropertyName.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index 63bd5b151a..d1af209d52 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -798,7 +798,7 @@ public final class ConfigurationPropertyName if ((end - start) < 1 || type == ElementType.EMPTY) { return; } - if (this.start.length <= end) { + if (this.start.length == this.size) { this.start = expand(this.start); this.end = expand(this.end); this.type = expand(this.type);