aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java
diff options
context:
space:
mode:
authorAnkitkumar Patel <ankit@research.att.com>2018-01-29 22:42:19 -0500
committerAnkitkumar Patel <ankit@research.att.com>2018-01-31 15:57:42 -0500
commit401b48bc573561f097960a9ca7abe6d788456f28 (patch)
treea8f089325447333d535adbc9d23dbf182547845e /ONAP-PAP-REST/src/main/java
parent9301fed7c290f52208922f780fdfe4b5a880b5aa (diff)
Fixed the Sonar technical debt.
Fixed the sonar technical dept primarily for the POLICY-REST module, and accordingly updated the other policy-engine modules for successful built. Issue-ID: POLICY-476 Change-Id: I0e9bd7209a7f9af247fa409a1682683082f92698 Signed-off-by: Ankitkumar Patel <ankit@research.att.com>
Diffstat (limited to 'ONAP-PAP-REST/src/main/java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java22
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticData.java36
2 files changed, 28 insertions, 30 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
index aad70e5dd..af7895695 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
@@ -70,7 +70,7 @@ public class CreateNewMicroServiceModel {
this.newModel.setUserCreatedBy(userInfo);
String cleanUpFile = null;
- HashMap<String, MSAttributeObject> tempMap = new HashMap<>();
+ Map<String, MSAttributeObject> tempMap = new HashMap<>();
//Need to delete the file
if (importFile.contains(".zip")){
extractFolder(randomID + ".zip");
@@ -143,16 +143,14 @@ public class CreateNewMicroServiceModel {
int currentByte;
byte data[] = new byte[BUFFER];
-
- FileOutputStream fos = new FileOutputStream(destFile);
- BufferedOutputStream dest = new BufferedOutputStream(fos,
- BUFFER);
-
- while ((currentByte = is.read(data, 0, BUFFER)) != -1) {
- dest.write(data, 0, currentByte);
- }
- dest.flush();
- dest.close();
+ try(FileOutputStream fos = new FileOutputStream(destFile);
+ BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER)) {
+
+ while ((currentByte = is.read(data, 0, BUFFER)) != -1) {
+ dest.write(data, 0, currentByte);
+ }
+ dest.flush();
+ }
is.close();
}
@@ -177,7 +175,7 @@ public class CreateNewMicroServiceModel {
Map<String, String> successMap = new HashMap<>();
MSAttributeObject mainClass = null;
- ArrayList<String> dependency = null;
+ List<String> dependency = null;
String subAttribute = null;
if (!classMap.containsKey(this.newModel.getModelName())){
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticData.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticData.java
index cde05383d..e56e82cbf 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticData.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticData.java
@@ -41,10 +41,10 @@ public class PolicyElasticData {
private String jsonBody;
private Object jsonBodyData;
- private LinkedHashMap<?, ?> serviceTypePolicyName;
- private LinkedHashMap<?, ?> verticaMetrics;
- private LinkedHashMap<?, ?> description;
- private LinkedHashMap<?, ?> attributeFields;
+ private Map<?, ?> serviceTypePolicyName;
+ private Map<?, ?> verticaMetrics;
+ private Map<?, ?> description;
+ private Map<?, ?> attributeFields;
//Safe Policy
private String policyScope;
@@ -55,8 +55,8 @@ public class PolicyElasticData {
private String ttlDate;
private Map<String,String> matching;
- private ArrayList<Object> triggerSignatures;
- private ArrayList<Object> symptomSignatures;
+ private List<Object> triggerSignatures;
+ private List<Object> symptomSignatures;
private String logicalConnector;
private String policyStatus;
public String gocServerScope;
@@ -86,7 +86,7 @@ public class PolicyElasticData {
//FireWall
private String fwPolicyType;
- private ArrayList<Object> fwattributes;
+ private List<Object> fwattributes;
private String parentForChild;
private String securityZone;
@@ -262,7 +262,7 @@ public class PolicyElasticData {
public void setJsonBody(String jsonBody) {
this.jsonBody = jsonBody;
}
- public LinkedHashMap<?, ?> getServiceTypePolicyName() {
+ public Map<?, ?> getServiceTypePolicyName() {
return serviceTypePolicyName;
}
@@ -270,7 +270,7 @@ public class PolicyElasticData {
this.serviceTypePolicyName = serviceTypePolicyName;
}
- public LinkedHashMap<?, ?> getVerticaMetrics() {
+ public Map<?, ?> getVerticaMetrics() {
return verticaMetrics;
}
@@ -278,15 +278,15 @@ public class PolicyElasticData {
this.verticaMetrics = verticaMetrics;
}
- public LinkedHashMap<?, ?> getDescription() {
+ public Map<?, ?> getDescription() {
return description;
}
- public void setDescription(LinkedHashMap<?, ?> description) {
+ public void setDescription(Map<?, ?> description) {
this.description = description;
}
- public LinkedHashMap<?, ?> getAttributeFields() {
+ public Map<?, ?> getAttributeFields() {
return attributeFields;
}
@@ -335,13 +335,13 @@ public class PolicyElasticData {
public void setMatching(Map<String, String> matching) {
this.matching = matching;
}
- public ArrayList<Object> getTriggerSignatures() {
+ public List<Object> getTriggerSignatures() {
return triggerSignatures;
}
public void setTriggerSignatures(ArrayList<Object> triggerSignatures) {
this.triggerSignatures = triggerSignatures;
}
- public ArrayList<Object> getSymptomSignatures() {
+ public List<Object> getSymptomSignatures() {
return symptomSignatures;
}
public void setSymptomSignatures(ArrayList<Object> symptomSignatures) {
@@ -422,16 +422,16 @@ public class PolicyElasticData {
public List<String> getBrmsDependency() {
return brmsDependency;
}
- public void setBrmsDependency(ArrayList<String> brmsDependency) {
+ public void setBrmsDependency(List<String> brmsDependency) {
this.brmsDependency = brmsDependency;
}
- public LinkedHashMap<?, ?> getRuleData() {
+ public Map<?, ?> getRuleData() {
return ruleData;
}
public void setRuleData(LinkedHashMap<?, ?> ruleData) {
this.ruleData = ruleData;
}
- public LinkedHashMap<?, ?> getRuleListData() {
+ public Map<?, ?> getRuleListData() {
return ruleListData;
}
public void setRuleListData(LinkedHashMap<?, ?> ruleListData) {
@@ -473,7 +473,7 @@ public class PolicyElasticData {
public void setFwPolicyType(String fwPolicyType) {
this.fwPolicyType = fwPolicyType;
}
- public ArrayList<Object> getFwattributes() {
+ public List<Object> getFwattributes() {
return fwattributes;
}
public void setFwattributes(ArrayList<Object> fwattributes) {