summaryrefslogtreecommitdiffstats
path: root/ONAP-REST/src
diff options
context:
space:
mode:
authorTej, Tarun <tt3868@att.com>2017-08-21 20:00:50 -0400
committerTarun Tej Velaga <tt3868@att.com>2017-08-23 17:29:35 +0000
commit80f072f60509ef3a35369a60857fe05f6c2a993a (patch)
tree7dca6266b225be3f192623fdc859ca80f4d1d493 /ONAP-REST/src
parentc53fa990ea27ec074859eb94bcb7ec6deaa2157b (diff)
Fixes for sonar critical issues
Fixes for critical and blocker issues reported in sonar. Issue-Id: POLICY-113 Change-Id: I50969fe93a94b0497f3fb30864a6c45e63208fe6 Signed-off-by: Tej, Tarun <tt3868@att.com>
Diffstat (limited to 'ONAP-REST/src')
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java1
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java5
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java4
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java2
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java14
5 files changed, 15 insertions, 11 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java
index 5c8449603..73cb0f07e 100644
--- a/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java
@@ -95,7 +95,6 @@ public class XACMLRestProperties extends XACMLProperties {
public static final String PROP_PAP_URLS = "xacml.rest.pap.urls";
public static final String PROP_PAP_FAILED_URLS = "xacml.rest.pap.failedUrls";
public static final String PROP_PAP_SUCCEEDED_URLS = "xacml.rest.pap.succeededUrls";
- //public static final String PROP_PAP_FAILED_URL_TIME = "xacml.rest.pap.failedUrlTime";
/**
* Upon startup, have the PAP servlet send latest configuration information
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java
index c8dc71918..c29e17637 100644
--- a/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java
@@ -52,7 +52,7 @@ public class XacmlAdminAuthorization {
return userId;
}
- public void setUserId(UserInfo userId) {
+ public static void setUserId(UserInfo userId) {
XacmlAdminAuthorization.userId = userId;
}
@@ -66,6 +66,7 @@ public class XacmlAdminAuthorization {
AdminAction(String a) {
this.action = a;
}
+ @Override
public String toString() {
return this.action;
}
@@ -84,6 +85,7 @@ public class XacmlAdminAuthorization {
AdminResource(String r) {
this.resource = r;
}
+ @Override
public String toString() {
return this.resource;
}
@@ -102,6 +104,7 @@ public class XacmlAdminAuthorization {
Role(String a) {
this.userRole = a;
}
+ @Override
public String toString() {
return this.userRole;
}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java
index 57daf7ed8..6c7b8cf6f 100644
--- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java
@@ -317,8 +317,8 @@ public class PolicyEntity implements Serializable {
version == p.version &&
policyVersion == p.policyVersion &&
policyData.equals(p.policyData) &&
- ((configurationDataEntity == null && p.configurationDataEntity == null) || configurationDataEntity.equals(p.configurationDataEntity)) &&
- ((actionBodyEntity == null && p.actionBodyEntity == null) || actionBodyEntity.equals(p.actionBodyEntity)) &&
+ ((configurationDataEntity == null && p.configurationDataEntity == null) || (configurationDataEntity!=null && configurationDataEntity.equals(p.configurationDataEntity))) &&
+ ((actionBodyEntity == null && p.actionBodyEntity == null) || (actionBodyEntity!=null && actionBodyEntity.equals(p.actionBodyEntity))) &&
createdBy.equals(p.createdBy) &&
createdDate.equals(p.createdDate) &&
description.equals(p.description) &&
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java
index 2a6571e52..c79ee1e82 100644
--- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java
@@ -62,7 +62,7 @@ public class PolicyManagement implements Serializable {
private String configName;
@Column(name="XML", nullable=false)
- private Clob xml;
+ private transient Clob xml;
@Column(name="CREATE_DATE_TIME", nullable=false)
private Timestamp createDateTime;
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java
index 908078f73..1fb8ec531 100644
--- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java
@@ -30,6 +30,8 @@ import org.apache.commons.logging.LogFactory;
import org.onap.policy.rest.XACMLRestProperties;
import org.onap.policy.xacml.api.XACMLErrorConstants;
+
+import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.util.XACMLProperties;
import org.onap.policy.common.logging.eelf.MessageCodes;
@@ -46,8 +48,8 @@ public class Webapps {
public static String getConfigHome(){
try {
loadWebapps();
- } catch (Exception e) {
- logger.error("Exception Occured while loading webapps"+e);
+ } catch (PAPException e) {
+ logger.error("Exception Occured while loading webapps",e);
return null;
}
return configHome;
@@ -56,14 +58,14 @@ public class Webapps {
public static String getActionHome(){
try {
loadWebapps();
- } catch (Exception e) {
- logger.error("Exception Occured while loading webapps"+e);
+ } catch (PAPException e) {
+ logger.error("Exception Occured while loading webapps",e);
return null;
}
return actionHome;
}
- private static void loadWebapps() throws Exception{
+ private static void loadWebapps() throws PAPException{
String errorMessageName = "Invalid Webapps Path Location property :";
if(actionHome == null || configHome == null){
Path webappsPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS));
@@ -71,7 +73,7 @@ public class Webapps {
if (webappsPath == null) {
logger.error(errorMessageName + XACMLRestProperties.PROP_PAP_WEBAPPS);
PolicyLogger.error(errorMessageName + XACMLRestProperties.PROP_PAP_WEBAPPS);
- throw new Exception(errorMessageName + XACMLRestProperties.PROP_PAP_WEBAPPS);
+ throw new PAPException(errorMessageName + XACMLRestProperties.PROP_PAP_WEBAPPS);
}
Path webappsPathConfig;
Path webappsPathAction;