summaryrefslogtreecommitdiffstats
path: root/aai-service/provider/src
diff options
context:
space:
mode:
authorsurya-huawei <a.u.surya@huawei.com>2017-09-14 15:56:03 +0530
committersurya-huawei <a.u.surya@huawei.com>2017-09-14 15:57:00 +0530
commit331e512b29fa7bf5de5c20e5c913677f11979e4d (patch)
tree7ff089eacc43f5adec059451f90a5ca0918a4db1 /aai-service/provider/src
parent214cb38f182ed7d7b1d19da0603df0a894a2db85 (diff)
Fix Sonar Issues
few major issues in sli/adaptors module Issue-Id: CCSDK-87 Change-Id: I43865634fa7d5f5d1b84c7efff691047cfcd5feb Signed-off-by: surya-huawei <a.u.surya@huawei.com>
Diffstat (limited to 'aai-service/provider/src')
-rw-r--r--aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java7
-rw-r--r--aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java20
2 files changed, 14 insertions, 13 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
index 413d85a5..61df1708 100644
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
@@ -245,7 +245,8 @@ public abstract class AAIDeclarations implements AAIClient {
}
ctx.setAttribute(prefix + ".error.message", exc.getMessage());
if(errorCode >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" + exc.getReturnCode());
+ ctx.setAttribute(prefix + ".error.http.response-code",
+ Integer.toString(exc.getReturnCode()));
}
return QueryStatus.FAILURE;
}
@@ -1295,8 +1296,8 @@ public abstract class AAIDeclarations implements AAIClient {
j++;
}
AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
- for(String key1 : relParams.keySet()) {
- rlRequest.addRequestProperty(key1, relParams.get(key1));
+ for(Map.Entry<String,String> entry : relParams.entrySet()) {
+ rlRequest.addRequestProperty(entry.getKey(), entry.getValue());
}
String path = rlRequest.updatePathDataValues(null);
relationship.setRelatedLink(path);
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
index c6145f8a..03121ac0 100644
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
@@ -140,11 +140,11 @@ public abstract class AAIRequest {
/**
* Map containing resource tag to its bit position in bitset mapping
*/
- private static Map<String, String> tagValues = new LinkedHashMap<String, String>();
+ private static Map<String, String> tagValues = new LinkedHashMap<>();
/**
* Map containing bitset value of the path to its path mapping
*/
- private static Map<BitSet, String> bitsetPaths = new LinkedHashMap<BitSet, String>();
+ private static Map<BitSet, String> bitsetPaths = new LinkedHashMap<>();
public static Set<String> getResourceNames() {
@@ -180,7 +180,7 @@ public abstract class AAIRequest {
Set<String> keys = properties.stringPropertyNames();
int index = 0;
- Set<String> resourceNames = new TreeSet<String>();
+ Set<String> resourceNames = new TreeSet<>();
for(String key : keys) {
String[] tags = key.split("\\|");
@@ -325,8 +325,8 @@ public abstract class AAIRequest {
}
protected static Set<String> extractUniqueResourceSetFromKeys(Set<String> keySet) {
- Set<String> uniqueResources = new TreeSet<String>();
- List<String> keys = new ArrayList<String>(keySet);
+ Set<String> uniqueResources = new TreeSet<>();
+ List<String> keys = new ArrayList<>(keySet);
for(String resource : keys) {
if(resource.contains(".")) {
String [] split = resource.split("\\.");
@@ -339,7 +339,7 @@ public abstract class AAIRequest {
public void processRequestPathValues(Map<String, String> nameValues) {
Set<String> uniqueResources = extractUniqueResourceSetFromKeys(nameValues.keySet());
- Set<String> tokens = new TreeSet<String>();
+ Set<String> tokens = new TreeSet<>();
tokens.add(DEPTH);
tokens.addAll(Arrays.asList(this.getArgsList()));
@@ -409,12 +409,12 @@ public abstract class AAIRequest {
}
public static Map<String, String> splitQuery(String query) throws UnsupportedEncodingException {
- Map<String, String> query_pairs = new LinkedHashMap<String, String>();
+ Map<String, String> query_pairs = new LinkedHashMap<>();
if(query != null && !query.isEmpty()) {
String[] pairs = query.split("&");
for (String pair : pairs) {
- int idx = pair.indexOf("=");
+ int idx = pair.indexOf('=');
query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
}
}
@@ -422,12 +422,12 @@ public abstract class AAIRequest {
}
public static Map<String, String> splitPath(String path) throws UnsupportedEncodingException {
- Map<String, String> query_pairs = new LinkedHashMap<String, String>();
+ Map<String, String> query_pairs = new LinkedHashMap<>();
if(path != null && !path.isEmpty()) {
String[] pairs = path.split("/");
for (String pair : pairs) {
- int idx = pair.indexOf("=");
+ int idx = pair.indexOf('=');
query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
}
}