summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src
diff options
context:
space:
mode:
authorArindam Mondal <arind.mondal@samsung.com>2019-09-17 15:11:10 +0900
committerarind.mondal <arind.mondal@samsung.com>2019-09-17 15:12:55 +0900
commit32c146dacb247d512690f5e95ace5b71ce6dc02e (patch)
treeb6185d329489a16ab29c7d86f7f10767b8b09459 /ecomp-portal-BE-common/src
parent99a220e3fccdabca5c5d1f63582a77a0379ac057 (diff)
Sonar fix npe,logger
Issue-ID: PORTAL-740 Change-Id: I7828f6ef16b75ba4ca90650eb47f188512a1791d Signed-off-by: arind.mondal <arind.mondal@samsung.com>
Diffstat (limited to 'ecomp-portal-BE-common/src')
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java22
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());
}