Multiple Sonar Fixes
Issue-ID: HOLMES-197
Change-Id: Ic7bf196d2cf9da602b5a731a4a73a315e0f9733a
Signed-off-by: Driptaroop Das <driptaroop.das@in.ibm.com>
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
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.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;
import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.utils.HttpsUtils;
}
private String getVmUrl(String vserverId, String vserverName) throws CorrelationException {
}
private String getVmUrl(String vserverId, String vserverName) throws CorrelationException {
String resourceLinkUrl = getVmResourceLinks(vserverId, vserverName);
return getBaseUrl("") + resourceLinkUrl;
}
String resourceLinkUrl = getVmResourceLinks(vserverId, vserverName);
return getBaseUrl("") + resourceLinkUrl;
}
private MultivaluedMap<String, Object> headers;
private MultivaluedMap<String, Object> headers;
- static public AaiQuery4Ccvpn newInstance() {
+ public static AaiQuery4Ccvpn newInstance() {
return new AaiQuery4Ccvpn();
}
return new AaiQuery4Ccvpn();
}
private String getPath(String urlTemplate, Map<String, String> pathParams) {
String url = urlTemplate;
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());
- public VnfEntity convertJsonToVnfEntity(String responseJson) throws IOException {
+ public VnfEntity convertJsonToVnfEntity(String responseJson) {
JSONObject jsonObject = JSON.parseObject(responseJson);
if (jsonObject.isEmpty()) {
JSONObject jsonObject = JSON.parseObject(responseJson);
if (jsonObject.isEmpty()) {
\r
import com.google.gson.annotations.SerializedName;\r
\r
\r
import com.google.gson.annotations.SerializedName;\r
\r
-import java.io.Closeable;\r
import java.util.Date;\r
import java.util.Properties;\r
\r
import java.util.Date;\r
import java.util.Properties;\r
\r
public static final byte EVENT_RAISED = 0;\r
\r
private static final long serialVersionUID = 4520003737132012000L;\r
public static final byte EVENT_RAISED = 0;\r
\r
private static final long serialVersionUID = 4520003737132012000L;\r
- private final static Date clearedServerTime = null;\r
- private final Map<Integer, Integer> linkIdNodeIdxMap = new HashMap<Integer, Integer>();\r
+ private static final Date clearedServerTime = null;\r
+ private final Map<Integer, Integer> linkIdNodeIdxMap = new HashMap<>();\r
private byte eventType = EVENT_RAISED;\r
private long id = 0L;\r
private String alarmKey = "";\r
private byte eventType = EVENT_RAISED;\r
private long id = 0L;\r
private String alarmKey = "";\r
private boolean rootAlarmFlag = false;\r
private int linkId = -1;\r
private int nodeIdx = -1;\r
private boolean rootAlarmFlag = false;\r
private int linkId = -1;\r
private int nodeIdx = -1;\r
- private Set<Integer> linkIds = new HashSet<Integer>();\r
- private HashMap<String, Integer> priorityMap = new HashMap<String, Integer>();\r
- private HashMap<String, Integer> rootAlarmTypeMap = new HashMap<String, Integer>();\r
+ private Set<Integer> linkIds = new HashSet<>();\r
+ private HashMap<String, Integer> priorityMap = new HashMap<>();\r
+ private HashMap<String, Integer> rootAlarmTypeMap = new HashMap<>();\r
private int rootAlarmType = -1;\r
private boolean keyAlarmFlag = false;\r
private int keyAlarmType = -1;\r
private int rootAlarmType = -1;\r
private boolean keyAlarmFlag = false;\r
private int keyAlarmType = -1;\r
* number of locations in otherIdIdx (otherIdIdx) with the site):1,\r
*/\r
public int CompareLinkPosition(Map<Integer, Integer> otherIdIdx) {\r
* number of locations in otherIdIdx (otherIdIdx) with the site):1,\r
*/\r
public int CompareLinkPosition(Map<Integer, Integer> otherIdIdx) {\r
- Set<Integer> myIdSet = new HashSet<Integer>();\r
+ Set<Integer> myIdSet = new HashSet<>();\r
myIdSet.addAll(this.linkIdNodeIdxMap.keySet());\r
myIdSet.retainAll(otherIdIdx.keySet());\r
\r
myIdSet.addAll(this.linkIdNodeIdxMap.keySet());\r
myIdSet.retainAll(otherIdIdx.keySet());\r
\r
\r
\r
public boolean containsPriority(String ruleId) {\r
\r
\r
public boolean containsPriority(String ruleId) {\r
- if (priorityMap.keySet().contains(ruleId)) {\r
- return true;\r
- }\r
- return false;\r
+ return priorityMap.keySet().contains(ruleId);\r
}\r
\r
public int getPriority(String ruleId) {\r
}\r
\r
public int getPriority(String ruleId) {\r
}\r
\r
public int getRootAlarmType(String ruleId) {\r
}\r
\r
public int getRootAlarmType(String ruleId) {\r
- Integer rootAlarmType = this.rootAlarmTypeMap.get(ruleId);\r
- if (rootAlarmType == null) {\r
- rootAlarmType = -1;\r
- }\r
- return rootAlarmType;\r
+ Integer rootAlarmTypeVar = this.rootAlarmTypeMap.get(ruleId);\r
+ return (rootAlarmTypeVar == null) ? -1 : rootAlarmTypeVar;\r
enrichVnfInfo(vmEntity, childAlarm, policyMsg);
policyMsg.setClosedLoopEventStatus(EVENT_STATUS.ONSET);
try {
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",
} 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);
} 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);