summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-02-20 15:42:37 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-20 15:42:37 +0000
commit7babb8153d36b09e536720258f403535b79f9243 (patch)
tree4349b2c2cadfcc1b684068c53bcb9a9e37b99bdb
parent08cfe71e774b5700e2c2a6e56a47c1ab4ee1ee37 (diff)
parent1eb4ca4ae59358034c34dade0995768d95d7abb9 (diff)
Merge "Minor fix to avoid ConcurrentModificationException in policy-models"
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
index 77633bd27..88591bd91 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
@@ -21,13 +21,11 @@
package org.onap.policy.models.tosca.utils;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
import java.util.function.Function;
-
import javax.ws.rs.core.Response;
-
import lombok.NonNull;
-
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.models.base.PfConcept;
import org.onap.policy.models.base.PfConceptContainer;
@@ -263,9 +261,11 @@ public final class ToscaUtils {
@SuppressWarnings("unchecked")
Set<JpaToscaEntityType<?>> filteredEntitySet =
- (Set<JpaToscaEntityType<?>>) entityTypes.getAll(entityName, entityVersion);
+ (Set<JpaToscaEntityType<?>>) entityTypes.getAll(entityName, entityVersion);
+ Set<JpaToscaEntityType<?>> filteredEntitySetToReturn = new HashSet<>(filteredEntitySet);
for (JpaToscaEntityType<?> filteredEntityType : filteredEntitySet) {
- filteredEntitySet.addAll(ToscaUtils.getEntityTypeAncestors(entityTypes, filteredEntityType, result));
+ filteredEntitySetToReturn
+ .addAll(ToscaUtils.getEntityTypeAncestors(entityTypes, filteredEntityType, result));
}
if (!result.isValid()) {
@@ -273,6 +273,6 @@ public final class ToscaUtils {
}
entityTypes.getConceptMap().entrySet()
- .removeIf(entityEntry -> !filteredEntitySet.contains(entityEntry.getValue()));
+ .removeIf(entityEntry -> !filteredEntitySetToReturn.contains(entityEntry.getValue()));
}
}