summaryrefslogtreecommitdiffstats
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
parent99a220e3fccdabca5c5d1f63582a77a0379ac057 (diff)
Sonar fix npe,logger
Issue-ID: PORTAL-740 Change-Id: I7828f6ef16b75ba4ca90650eb47f188512a1791d Signed-off-by: arind.mondal <arind.mondal@samsung.com>
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java22
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java7
2 files changed, 17 insertions, 12 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());
}
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java
index 6901aeef..a965c62d 100644
--- a/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java
+++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java
@@ -54,7 +54,9 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.onap.portal.domain.db.fn.FnUser;
+import org.onap.portal.utils.EcompPortalUtils;
import org.onap.portalsdk.core.domain.FusionVo;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@Getter
@Setter
@@ -73,7 +75,8 @@ public class DomainVo extends FusionVo implements Serializable, Cloneable, Compa
protected Long rowNum;
protected Serializable auditUserId;
protected Set auditTrail = null;
-
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DomainVo.class);
+
@Override
public int compareTo(Object obj) {
Long c1 = this.getId();
@@ -99,7 +102,7 @@ public class DomainVo extends FusionVo implements Serializable, Cloneable, Compa
newVo.setId(null);
}
} catch (Exception var8) {
- var8.printStackTrace();
+ logger.error("exception occured",var8);
}
return newVo;