summaryrefslogtreecommitdiffstats
path: root/ONAP-XACML/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-XACML/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-XACML/src')
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java14
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java2
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java7
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java18
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java2
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java10
6 files changed, 26 insertions, 27 deletions
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java
index 3132b8cac..14d7c7f62 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java
@@ -69,10 +69,10 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
private static Log logger = LogFactory.getLog(StdEngine.class);
- public static String PROP_PAP_REPO = "xacml.pap.pdps";
- public static String PROP_PAP_GROUPS = "xacml.pap.groups";
- public static String PROP_PAP_GROUPS_DEFAULT = "xacml.pap.groups.default";
- public static String PROP_PAP_GROUPS_DEFAULT_NAME = "default";
+ public static final String PROP_PAP_REPO = "xacml.pap.pdps";
+ public static final String PROP_PAP_GROUPS = "xacml.pap.groups";
+ public static final String PROP_PAP_GROUPS_DEFAULT = "xacml.pap.groups.default";
+ public static final String PROP_PAP_GROUPS_DEFAULT_NAME = "default";
//this value will be accessed from XacmlPapServlet so that we know if a default group did not exist
//and was just added. This way, we can add the new group to the database.
public boolean wasDefaultGroupJustAdded = false;
@@ -892,7 +892,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
try {
((StdPDPGroup)group).saveGroupConfiguration();
} catch (IOException e) {
- throw new PAPException("Unable to save new configuration for '" + group.getName() + "': " + e.getMessage());
+ throw new PAPException("Unable to save new configuration for '" + group.getName() + "': " + e.getMessage(), e);
}
// update the group in the set by simply replacing the old instance with the new one
this.groups.remove(existingGroup);
@@ -923,13 +923,13 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
}
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Unable to rename directory");
- throw new PAPException("Unable to move directory from '" + oldPath + "' to '" + newPath + "': " + e.getMessage());
+ throw new PAPException("Unable to move directory from '" + oldPath + "' to '" + newPath + "': " + e.getMessage(),e);
}
// update the disk
try {
((StdPDPGroup)group).saveGroupConfiguration();
} catch (IOException e) {
- throw new PAPException("Unable to save new configuration for '" + group.getName() + "': " + e.getMessage());
+ throw new PAPException("Unable to save new configuration for '" + group.getName() + "': " + e.getMessage(), e);
}
// save the new group into the Set
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
index d69f38d95..56676f38b 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
@@ -42,7 +42,7 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable{
private List<String> dynamicRuleAlgorithmCombo;
private List<String> dynamicRuleAlgorithmField1;
private List<String> dynamicRuleAlgorithmField2;
- private List<Object> dynamicVariableList;
+ private transient List<Object> dynamicVariableList;
private List<String> dataTypeList;
private String configBodyData = null;
private String policyID = null;
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java
index 20dbfae07..4c1f4aadc 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java
@@ -45,11 +45,11 @@ public class StdPDP extends StdPDPItemSetChangeNotifier implements OnapPDP, Comp
private Integer jmxport = 0;
- private PDPStatus status = new StdPDPStatus();
+ private transient PDPStatus status = new StdPDPStatus();
- private Set<PDPPolicy> policies = new HashSet<>();
+ private transient Set<PDPPolicy> policies = new HashSet<>();
- private Set<PDPPIPConfig> pipConfigs = new HashSet<>();
+ private transient Set<PDPPIPConfig> pipConfigs = new HashSet<>();
public StdPDP() {
@@ -89,7 +89,6 @@ public class StdPDP extends StdPDPItemSetChangeNotifier implements OnapPDP, Comp
} else if (key.toString().endsWith(".description")) {
this.description = properties.getProperty(key.toString());
}else if (key.toString().endsWith(".jmxport")) {
- //todo fix this hackjob
if (properties.getProperty(key.toString()) != null && properties.getProperty(key.toString()).trim().length() > 0){
logger.debug("initialize before: " + this.jmxport);
this.jmxport = Integer.valueOf( properties.getProperty(key.toString()));
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java
index 63cc4b4fc..28f6a4d03 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java
@@ -70,20 +70,20 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG
private String description;
- private StdPDPGroupStatus status = new StdPDPGroupStatus(Status.UNKNOWN);
+ private transient StdPDPGroupStatus status = new StdPDPGroupStatus(Status.UNKNOWN);
- private Set<OnapPDP> pdps = new HashSet<>();
+ private transient Set<OnapPDP> pdps = new HashSet<>();
- private Set<PDPPolicy> policies = new HashSet<>();
+ private transient Set<PDPPolicy> policies = new HashSet<>();
- private Set<PDPPolicy> selectedPolicies = new HashSet<>();
+ private transient Set<PDPPolicy> selectedPolicies = new HashSet<>();
- private Set<PDPPIPConfig> pipConfigs = new HashSet<>();
+ private transient Set<PDPPIPConfig> pipConfigs = new HashSet<>();
private String operation;
@JsonIgnore
- private Path directory;
+ private transient Path directory;
@JsonIgnore
private Integer jmxport;
@@ -187,7 +187,7 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG
try (OutputStream os = Files.newOutputStream(file)) {
policyProperties.store(os, "");
} catch (Exception e) {
- throw new PAPException("Failed to create new default policy properties file '" + file +"'");
+ throw new PAPException("Failed to create new default policy properties file '" + file +"'", e);
}
} else {
// load previously existing file
@@ -225,13 +225,13 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements OnapPDPG
pipProperties.store(os, "");
}
} catch (Exception e) {
- throw new PAPException("Failed to create new default pip properties file '" + file +"'");
+ throw new PAPException("Failed to create new default pip properties file '" + file +"'", e);
}
//Even if we create a new pip file, we still need to parse and load the properties
try{
this.readPIPProperties(directory, pipProperties);
}catch(Exception e){
- throw new PAPException("Failed to load the new pip properties file");
+ throw new PAPException("Failed to load the new pip properties file", e);
}
} else {
try {
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
index d23501f26..cc80b62c2 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
@@ -41,7 +41,7 @@ public class StdPDPItemSetChangeNotifier {
public void addItemSetChangeListener(StdItemSetChangeListener listener) {
if (this.listeners == null) {
- this.listeners = new LinkedList<StdItemSetChangeListener>();
+ this.listeners = new LinkedList<>();
}
this.listeners.add(listener);
}
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java
index f8759956c..5349f8340 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java
@@ -38,15 +38,15 @@ public class StdPDPStatus implements Serializable, PDPStatus {
private Set<String> loadWarnings = new HashSet<>();
- private Set<PDPPolicy> loadedPolicies = new HashSet<>();
+ private transient Set<PDPPolicy> loadedPolicies = new HashSet<>();
- private Set<PDPPolicy> loadedRootPolicies = new HashSet<>();
+ private transient Set<PDPPolicy> loadedRootPolicies = new HashSet<>();
- private Set<PDPPolicy> failedPolicies = new HashSet<>();
+ private transient Set<PDPPolicy> failedPolicies = new HashSet<>();
- private Set<PDPPIPConfig> loadedPIPConfigs = new HashSet<>();
+ private transient Set<PDPPIPConfig> loadedPIPConfigs = new HashSet<>();
- private Set<PDPPIPConfig> failedPIPConfigs = new HashSet<>();
+ private transient Set<PDPPIPConfig> failedPIPConfigs = new HashSet<>();
public StdPDPStatus() {
}