aboutsummaryrefslogtreecommitdiffstats
path: root/aai-service/provider/src
diff options
context:
space:
mode:
authorezhil <ezhrajam@in.ibm.com>2019-01-08 22:17:46 +0530
committerEzhilarasi R <ezhrajam@in.ibm.com>2019-01-09 06:43:10 +0000
commit5d4080b4ebb5119e00b2ddf813af3de8e81aafaf (patch)
treee464ba6e6417857932075c7273692586c16bbf3f /aai-service/provider/src
parent26f865938e18be289d51956663956ec315200910 (diff)
Fixed major sonar issue in AAIService.java
Change-Id: Ice32a830fa2d9885b64f7ce7a0d0fb47c268cb67 Issue-ID: CCSDK-914 Signed-off-by: ezhil <ezhrajam@in.ibm.com>
Diffstat (limited to 'aai-service/provider/src')
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java43
1 files changed, 24 insertions, 19 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
index 78b0f0eb..43038947 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,7 +23,6 @@
package org.onap.ccsdk.sli.adaptors.aai;
-
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -113,7 +114,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
private final String targetUri;
private final String networkVserverPath;
- private final String svc_inst_qry_path;
+ private final String svc_inst_query_path;
private final String ubb_notify_path;
private final String selflinkAvpn;
@@ -147,16 +148,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
this(getProperties(url));
}
- private static Properties getProperties(URL url) {
- Properties properties = new Properties();
- try {
- properties.load(url.openStream());
- } catch (IOException exc) {
- LOG.error("getProperties", exc);
- }
- return properties;
- }
-
public AAIService(Properties props) {
LOG.info("Entered AAIService.ctor");
@@ -222,7 +213,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
networkVserverPath =props.getProperty(NETWORK_VSERVER_PATH);
props.getProperty(SVC_INSTANCE_PATH);
- svc_inst_qry_path = props.getProperty(SVC_INST_QRY_PATH);
+ svc_inst_query_path = props.getProperty(SVC_INST_QRY_PATH);
props.getProperty(PARAM_SERVICE_TYPE, "service-type");
props.getProperty(P_INTERFACE_PATH);
@@ -324,11 +315,21 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
methodsField.set(null, methods);
} catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) {
- e.printStackTrace();
+ LOG.error("Exception occured", e);
}
}
+ private static Properties getProperties(URL url) {
+ Properties properties = new Properties();
+ try {
+ properties.load(url.openStream());
+ } catch (IOException exc) {
+ LOG.error("getProperties", exc);
+ }
+ return properties;
+ }
+
public void setExecutor(AAIExecutorInterface executor) {
this.executor = executor;
}
@@ -426,7 +427,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
InputStream inputStream = null;
try {
- String path = svc_inst_qry_path;
+ String path = svc_inst_query_path;
path = path.replace("{svc-instance-id}", encodeQuery(svc_instance_id));
String request_url = targetUri+path;
@@ -474,6 +475,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
try {
inputStream.close();
} catch(Exception exc) {
+ LOG.warn("Error closing Inputstream", exc);
}
}
}
@@ -729,7 +731,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
try {
inputStream.close();
} catch(Exception exc) {
-
+ LOG.warn("Error closing InputStream", exc);
}
}
}
@@ -846,7 +848,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
if(inputStream != null)
inputStream.close();
} catch (Exception exc) {
-
+ LOG.warn("Error closing Input stream", exc);
}
}
}
@@ -906,7 +908,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
try {
inputStream.close();
} catch(Exception exc) {
-
+ LOG.warn("Error closing Input stream", exc);
}
}
}
@@ -976,7 +978,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
try {
inputStream.close();
} catch(Exception exc) {
-
+ LOG.warn("Error closing Input stream", exc);
}
}
}
@@ -1208,12 +1210,14 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
try {
u = new URL(url);
} catch (MalformedURLException e) {
+ LOG.warn("MalformedURLException", e);
return false;
}
try {
u.toURI();
} catch (URISyntaxException e) {
+ LOG.warn("URISyntaxException", e);
return false;
}
@@ -1228,6 +1232,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
try {
u = new URI(url);
} catch (URISyntaxException e) {
+ LOG.warn("URISyntaxException", e);
return false;
}