summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2022-01-13 10:03:44 +0000
committerMichael Morris <michael.morris@est.tech>2022-01-17 10:20:46 +0000
commit08e100185603620b455d8e0e421de0b66d97fbee (patch)
treee1b6a85f651fc1396b80904c211d8e98f80e4518
parent5ea7aeab94051f17d9e5e31b53302eef912b9c6a (diff)
Fix use of Optional in EntitlementPoolZusammenDaoImpl
Checking the Optionals are present before getting their values in the EntitlementPoolZusammenDaoImpl class Issue-ID: SDC-3835 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: I9e2ead4b88510499ae6c8377c95bba3be21935a7
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java
index aa90df8389..2216519031 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java
@@ -170,10 +170,13 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
ElementContext elementContext = new ElementContext(entitlementPoolEntity.getVendorLicenseModelId(),
entitlementPoolEntity.getVersion().getId());
Optional<ElementInfo> elementInfo1 = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPoolEntity.getId()));
- Map<String, Object> properties = elementInfo1.get().getInfo().getProperties();
String manufacturerReferenceNumber = null;
- if (properties != null && properties.containsKey("manufacturerReferenceNumber")) {
- manufacturerReferenceNumber = (String) properties.get("manufacturerReferenceNumber");
+ if (elementInfo1.isPresent()) {
+ Map<String, Object> properties = elementInfo1.get().getInfo().getProperties();
+
+ if (properties != null && properties.containsKey("manufacturerReferenceNumber")) {
+ manufacturerReferenceNumber = (String) properties.get("manufacturerReferenceNumber");
+ }
}
return manufacturerReferenceNumber;
}