summaryrefslogtreecommitdiffstats
path: root/models-tosca/src/main/java
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2020-02-20 11:58:45 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2020-02-20 13:12:18 +0000
commit1eb4ca4ae59358034c34dade0995768d95d7abb9 (patch)
tree946b7b0c6dc58c3899d2eec244ccc2cd2fb08bf9 /models-tosca/src/main/java
parent6226a42370795501971179de2fb2841a5de9ce6b (diff)
Minor fix to avoid ConcurrentModificationException in policy-models
Change-Id: If737f6ae0bcb0f8c694711a67a3c879fee8c11c5 Issue-ID: POLICY-1402 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'models-tosca/src/main/java')
-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()));
}
}