summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorshikha0203 <shivani.khare@est.tech>2023-02-27 17:21:44 +0000
committerMichael Morris <michael.morris@est.tech>2023-03-01 14:21:44 +0000
commit3477e62a0cb8ae94ba4f68ce79ba644584c222f3 (patch)
tree59637a0bec5086cb578c94db4774107ce0848c4f /catalog-be/src/main
parenta63ba175e7dfe7744f4ae36036f53bdd21d25fa4 (diff)
PortalRestApiCentralServiceImpl- Add null test before using nullable values
Issue-ID: SDC-4415 Signed-off-by: shikha0203 <shivani.khare@est.tech> Change-Id: I4fa7db7e6def7448fe3ae81923d83a6ec325bf3f
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestApiCentralServiceImpl.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestApiCentralServiceImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestApiCentralServiceImpl.java
index 55ce879bde..945bf7e0f2 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestApiCentralServiceImpl.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestApiCentralServiceImpl.java
@@ -65,8 +65,14 @@ public final class PortalRestApiCentralServiceImpl implements IPortalRestCentral
public PortalRestApiCentralServiceImpl() throws PortalAPIException {
try {
ApplicationContext ctx = ContextLoader.getCurrentWebApplicationContext();
- userBusinessLogic = (UserBusinessLogic) ctx.getBean("userBusinessLogic");
- userBusinessLogicExt = (UserBusinessLogicExt) ctx.getBean("userBusinessLogicExt");
+ if (ctx == null) {
+ log.debug("Failed to get CurrentWebApplicationContext.");
+ BeEcompErrorManager.getInstance().logInternalUnexpectedError("constructor", "Failed to get CurrentWebApplicationContext. Can't get UserBusinessLogic and userBusinessLogicExt", BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException("CurrentWebApplicationContext is null. Failed to get Bean userBusinessLogic and userBusinessLogicExt");
+ } else {
+ userBusinessLogic = (UserBusinessLogic) ctx.getBean("userBusinessLogic");
+ userBusinessLogicExt = (UserBusinessLogicExt) ctx.getBean("userBusinessLogicExt");
+ }
} catch (Exception e) {
log.debug("Failed to get user UserBusinessLogic", e);
BeEcompErrorManager.getInstance()