summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/main/java/org
diff options
context:
space:
mode:
authorDriptaroop Das <driptaroop.das@in.ibm.com>2019-01-22 15:38:59 +0530
committerDriptaroop Das <driptaroop.das@in.ibm.com>2019-01-22 15:39:15 +0530
commit4f48419205730ecc3e34d93efc99cd76b81f9a59 (patch)
tree8892f438371233c0bc9fd767d25c0aef9fe8f101 /holmes-actions/src/main/java/org
parentdd26bae61d5323e03bde0bbf8570f0af1de1af41 (diff)
Multiple Sonar Fixes
Multiple Sonar Fixes Issue-ID: HOLMES-197 Change-Id: Ic7bf196d2cf9da602b5a731a4a73a315e0f9733a Signed-off-by: Driptaroop Das <driptaroop.das@in.ibm.com>
Diffstat (limited to 'holmes-actions/src/main/java/org')
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java3
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java6
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java1
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java24
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java4
6 files changed, 15 insertions, 25 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java
index d528547..919f329 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java
@@ -22,13 +22,11 @@ import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.CloseableHttpClient;
import org.jvnet.hk2.annotations.Service;
import org.onap.holmes.common.aai.config.AaiConfig;
import org.onap.holmes.common.aai.entity.VmEntity;
import org.onap.holmes.common.aai.entity.VnfEntity;
-import org.onap.holmes.common.config.MicroServiceConfig;
import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.utils.HttpsUtils;
@@ -59,7 +57,6 @@ public class AaiQuery {
}
private String getVmUrl(String vserverId, String vserverName) throws CorrelationException {
- String url = "";
String resourceLinkUrl = getVmResourceLinks(vserverId, vserverName);
return getBaseUrl("") + resourceLinkUrl;
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java
index 89cc991..d60a31b 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java
@@ -38,7 +38,7 @@ public class AaiQuery4Ccvpn {
private MultivaluedMap<String, Object> headers;
- static public AaiQuery4Ccvpn newInstance() {
+ public static AaiQuery4Ccvpn newInstance() {
return new AaiQuery4Ccvpn();
}
@@ -171,8 +171,8 @@ public class AaiQuery4Ccvpn {
private String getPath(String urlTemplate, Map<String, String> pathParams) {
String url = urlTemplate;
- for (String key : pathParams.keySet()) {
- url = url.replaceAll("\\{" + key + "\\}", pathParams.get(key));
+ for(Map.Entry<String, String> entry : pathParams.entrySet()){
+ url = url.replaceAll("\\{" + entry.getKey() + "\\}", entry.getValue());
}
return url;
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java
index 748dde0..5df05ca 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiResponseUtil.java
@@ -71,7 +71,7 @@ public class AaiResponseUtil {
return vmEntity;
}
- public VnfEntity convertJsonToVnfEntity(String responseJson) throws IOException {
+ public VnfEntity convertJsonToVnfEntity(String responseJson) {
JSONObject jsonObject = JSON.parseObject(responseJson);
if (jsonObject.isEmpty()) {
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java
index acfae35..db6c19f 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java
@@ -17,7 +17,6 @@ package org.onap.holmes.common.api.entity;
import com.google.gson.annotations.SerializedName;
-import java.io.Closeable;
import java.util.Date;
import java.util.Properties;
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java
index 4046307..b6cfc06 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java
@@ -37,8 +37,8 @@ public class Alarm implements AplusData, Cloneable, Serializable {
public static final byte EVENT_RAISED = 0;
private static final long serialVersionUID = 4520003737132012000L;
- private final static Date clearedServerTime = null;
- private final Map<Integer, Integer> linkIdNodeIdxMap = new HashMap<Integer, Integer>();
+ private static final Date clearedServerTime = null;
+ private final Map<Integer, Integer> linkIdNodeIdxMap = new HashMap<>();
private byte eventType = EVENT_RAISED;
private long id = 0L;
private String alarmKey = "";
@@ -64,9 +64,9 @@ public class Alarm implements AplusData, Cloneable, Serializable {
private boolean rootAlarmFlag = false;
private int linkId = -1;
private int nodeIdx = -1;
- private Set<Integer> linkIds = new HashSet<Integer>();
- private HashMap<String, Integer> priorityMap = new HashMap<String, Integer>();
- private HashMap<String, Integer> rootAlarmTypeMap = new HashMap<String, Integer>();
+ private Set<Integer> linkIds = new HashSet<>();
+ private HashMap<String, Integer> priorityMap = new HashMap<>();
+ private HashMap<String, Integer> rootAlarmTypeMap = new HashMap<>();
private int rootAlarmType = -1;
private boolean keyAlarmFlag = false;
private int keyAlarmType = -1;
@@ -86,7 +86,7 @@ public class Alarm implements AplusData, Cloneable, Serializable {
* number of locations in otherIdIdx (otherIdIdx) with the site):1,
*/
public int CompareLinkPosition(Map<Integer, Integer> otherIdIdx) {
- Set<Integer> myIdSet = new HashSet<Integer>();
+ Set<Integer> myIdSet = new HashSet<>();
myIdSet.addAll(this.linkIdNodeIdxMap.keySet());
myIdSet.retainAll(otherIdIdx.keySet());
@@ -175,10 +175,7 @@ public class Alarm implements AplusData, Cloneable, Serializable {
public boolean containsPriority(String ruleId) {
- if (priorityMap.keySet().contains(ruleId)) {
- return true;
- }
- return false;
+ return priorityMap.keySet().contains(ruleId);
}
public int getPriority(String ruleId) {
@@ -190,11 +187,8 @@ public class Alarm implements AplusData, Cloneable, Serializable {
}
public int getRootAlarmType(String ruleId) {
- Integer rootAlarmType = this.rootAlarmTypeMap.get(ruleId);
- if (rootAlarmType == null) {
- rootAlarmType = -1;
- }
- return rootAlarmType;
+ Integer rootAlarmTypeVar = this.rootAlarmTypeMap.get(ruleId);
+ return (rootAlarmTypeVar == null) ? -1 : rootAlarmTypeVar;
}
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java
index db57f3c..e3f6e58 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java
@@ -71,14 +71,14 @@ public class DmaapService {
enrichVnfInfo(vmEntity, childAlarm, policyMsg);
policyMsg.setClosedLoopEventStatus(EVENT_STATUS.ONSET);
try {
- policyMsg.getAai().put("vserver.in-maint", Boolean.valueOf(vmEntity.getInMaint()).booleanValue());
+ policyMsg.getAai().put("vserver.in-maint", vmEntity.getInMaint());
} catch (Exception e) {
log.error("Failed to parse the field \"in-maint\". A boolean string (\"true\"/\"false\")"
+ " is expected but the actual value is " + vmEntity.getInMaint() + ".", e);
}
try {
policyMsg.getAai().put("vserver.is-closed-loop-disabled",
- Boolean.valueOf(vmEntity.getClosedLoopDisable()).booleanValue());
+ vmEntity.getClosedLoopDisable());
} catch (Exception e) {
log.error("Failed to parse the field \"is-closed-loop-disabled\". A boolean string (\"true\"/\"false\")"
+ " is expected but the actual value is " + vmEntity.getClosedLoopDisable() + ".", e);