Browse Source

ListBasedXMLEventReader uses defensive modifiable copy of given List

pull/1897/head
Juergen Hoeller 6 years ago
parent
commit
9ab63b8494
  1. 9
      spring-core/src/main/java/org/springframework/util/xml/ListBasedXMLEventReader.java

9
spring-core/src/main/java/org/springframework/util/xml/ListBasedXMLEventReader.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.util.xml;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
import javax.xml.stream.events.XMLEvent;
@ -25,7 +25,8 @@ import org.springframework.lang.Nullable; @@ -25,7 +25,8 @@ import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
* Implementation of {@code XMLEventReader} based on a list of {@link XMLEvent XMLEvents}.
* Implementation of {@code XMLEventReader} based on a {@link List}
* of {@link XMLEvent} elements.
*
* @author Arjen Poutsma
* @since 5.0
@ -38,8 +39,8 @@ class ListBasedXMLEventReader extends AbstractXMLEventReader { @@ -38,8 +39,8 @@ class ListBasedXMLEventReader extends AbstractXMLEventReader {
public ListBasedXMLEventReader(List<XMLEvent> events) {
Assert.notNull(events, "'events' must not be null");
this.events = Collections.unmodifiableList(events);
Assert.notNull(events, "XMLEvent List must not be null");
this.events = new ArrayList<>(events);
}

Loading…
Cancel
Save