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
pull/15799/head
Andy Wilkinson 6 years ago
parent 2956b86035
commit 8ec6c372e4

@ -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);

Loading…
Cancel
Save