aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2022-01-12 12:57:15 +0000
committerFrancisco Javier Paradela Vila <javier.paradela.vila@est.tech>2022-01-12 13:02:38 +0000
commitd52bc4fff5b2f66e1616bf4c320d7dc9a9bf5702 (patch)
tree557400f9bcd56ec9ee34abe7d44fa71e9adfd388
parent33a4259fb3abbb2ccd8509b9e7288e61f1807b15 (diff)
Fix use of Optional in ModelOperation
Checking the Optionals are present before getting their values in the ModelOperation class Issue-ID: SDC-3832 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: Ia28c3ebbd32db83b54b4f8d5b5fa35dfa2c4af50
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
index b5cb9d98c0..b73f40f8f1 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
@@ -246,7 +246,8 @@ public class ModelOperation {
private Model convertToModel(final GraphVertex modelGraphVertex) {
final String modelName = (String) modelGraphVertex.getMetadataProperty(GraphPropertyEnum.NAME);
final String modelTypeProperty = (String) modelGraphVertex.getMetadataProperty(GraphPropertyEnum.MODEL_TYPE);
- final ModelTypeEnum modelType = StringUtils.isEmpty(modelTypeProperty) ? ModelTypeEnum.NORMATIVE : ModelTypeEnum.findByValue(modelTypeProperty).get();
+ final ModelTypeEnum modelType = StringUtils.isEmpty(modelTypeProperty) ? ModelTypeEnum.NORMATIVE :
+ ModelTypeEnum.findByValue(modelTypeProperty).isPresent() ? ModelTypeEnum.findByValue(modelTypeProperty).get() : ModelTypeEnum.NORMATIVE;
final Either<ImmutablePair<ModelData, GraphEdge>, JanusGraphOperationStatus> parentNode =
janusGraphGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Model), UniqueIdBuilder.buildModelUid(modelName),