Fixed issue with adding profile information to an unmodifiable list (#448)
This commit is contained in:
parent
f92c5a7232
commit
e2f03a9a26
|
@ -25,6 +25,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1870,13 +1871,17 @@ class ParserState<T> {
|
||||||
} else if (theLocalPart.equals("profile")) {
|
} else if (theLocalPart.equals("profile")) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<IdDt> profiles = (List<IdDt>) myMap.get(ResourceMetadataKeyEnum.PROFILES);
|
List<IdDt> profiles = (List<IdDt>) myMap.get(ResourceMetadataKeyEnum.PROFILES);
|
||||||
if (profiles == null) {
|
List<IdDt> newProfiles;
|
||||||
profiles = new ArrayList<IdDt>();
|
if (profiles != null) {
|
||||||
myMap.put(ResourceMetadataKeyEnum.PROFILES, profiles);
|
newProfiles = new ArrayList<IdDt>(profiles.size() + 1);
|
||||||
|
newProfiles.addAll(profiles);
|
||||||
|
} else {
|
||||||
|
newProfiles = new ArrayList<IdDt>(1);
|
||||||
}
|
}
|
||||||
IdDt profile = new IdDt();
|
IdDt profile = new IdDt();
|
||||||
push(new PrimitiveState(getPreResourceState(), profile));
|
push(new PrimitiveState(getPreResourceState(), profile));
|
||||||
profiles.add(profile);
|
newProfiles.add(profile);
|
||||||
|
myMap.put(ResourceMetadataKeyEnum.PROFILES, Collections.unmodifiableList(newProfiles));
|
||||||
} else if (theLocalPart.equals("tag")) {
|
} else if (theLocalPart.equals("tag")) {
|
||||||
TagList tagList = (TagList) myMap.get(ResourceMetadataKeyEnum.TAG_LIST);
|
TagList tagList = (TagList) myMap.get(ResourceMetadataKeyEnum.TAG_LIST);
|
||||||
if (tagList == null) {
|
if (tagList == null) {
|
||||||
|
|
Loading…
Reference in New Issue