summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManoop Talasila <talasila@research.att.com>2019-09-19 14:49:14 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-19 14:49:14 +0000
commited2612f4e00d54ed2a3acd3ee935ac9c174c99e6 (patch)
tree12985c581e0fa501c513b176f3fbcfa6f4495738
parent672b45b653ef0e88b13c337e598307ad66931390 (diff)
parent32c146dacb247d512690f5e95ace5b71ce6dc02e (diff)
Merge "Sonar fix npe,logger"
-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;