diff options
author | Manoop Talasila <talasila@research.att.com> | 2019-09-19 14:49:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-09-19 14:49:14 +0000 |
commit | ed2612f4e00d54ed2a3acd3ee935ac9c174c99e6 (patch) | |
tree | 12985c581e0fa501c513b176f3fbcfa6f4495738 /ecomp-portal-BE-common | |
parent | 672b45b653ef0e88b13c337e598307ad66931390 (diff) | |
parent | 32c146dacb247d512690f5e95ace5b71ce6dc02e (diff) |
Merge "Sonar fix npe,logger"
Diffstat (limited to 'ecomp-portal-BE-common')
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java index 45035a25..b718d56a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java @@ -121,17 +121,18 @@ public class WidgetsController extends EPRestrictedBaseController { @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); FieldsValidator fieldsValidator = null; - if (onboardingWidget!=null){ - if(!dataValidator.isValid(onboardingWidget)){ + if (onboardingWidget!=null && !dataValidator.isValid(onboardingWidget)){ fieldsValidator = new FieldsValidator(); fieldsValidator.setHttpStatusCode((long)HttpServletResponse.SC_NOT_ACCEPTABLE); return fieldsValidator; - } } if (userHasPermissions(user, response, "putOnboardingWidget")) { - onboardingWidget.id = widgetId; // ! - onboardingWidget.normalize(); + if (onboardingWidget != null) { + onboardingWidget.id = widgetId; // ! + onboardingWidget.normalize(); + } + fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget); response.setStatus(fieldsValidator.httpStatusCode.intValue()); } @@ -146,17 +147,18 @@ public class WidgetsController extends EPRestrictedBaseController { EPUser user = EPUserUtils.getUserSession(request); FieldsValidator fieldsValidator = null; - if (onboardingWidget!=null){ - if(!dataValidator.isValid(onboardingWidget)){ + if (onboardingWidget!=null && !dataValidator.isValid(onboardingWidget)){ fieldsValidator = new FieldsValidator(); fieldsValidator.setHttpStatusCode((long)HttpServletResponse.SC_NOT_ACCEPTABLE); return fieldsValidator; - } } if (userHasPermissions(user, response, "postOnboardingWidget")) { - onboardingWidget.id = null; // ! - onboardingWidget.normalize(); + + if (onboardingWidget != null) { + onboardingWidget.id = null; // ! + onboardingWidget.normalize(); + } fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget); response.setStatus(fieldsValidator.httpStatusCode.intValue()); } |