diff options
author | franciscovila <javier.paradela.vila@est.tech> | 2022-01-13 10:03:44 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-01-17 10:20:46 +0000 |
commit | 08e100185603620b455d8e0e421de0b66d97fbee (patch) | |
tree | e1b6a85f651fc1396b80904c211d8e98f80e4518 /openecomp-be/lib/openecomp-sdc-vendor-license-lib | |
parent | 5ea7aeab94051f17d9e5e31b53302eef912b9c6a (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
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib')
-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.java | 9 |
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; } |