Copy field names in stored fields context
We have to copy the field names otherwise we either have a handle of a list that a caller might mutate or we might mutate when they aren't expecting it, or worse, a handle of a list that is not mutable (and we end up mutating the list). Relates #44665
This commit is contained in:
parent
b34ac66d96
commit
ff76b0af8b
|
@ -67,7 +67,7 @@ public class StoredFieldsContext implements Writeable {
|
|||
public StoredFieldsContext(StreamInput in) throws IOException {
|
||||
this.fetchFields = in.readBoolean();
|
||||
if (fetchFields) {
|
||||
this.fieldNames = (List<String>) in.readGenericValue();
|
||||
this.fieldNames = new ArrayList<>((List<String>) in.readGenericValue());
|
||||
} else {
|
||||
this.fieldNames = null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue