Merge "Fixed major sonar issue in AAIService.java"
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 78b0f0e..4303894 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
try {
inputStream.close();
} catch(Exception exc) {
+ LOG.warn("Error closing Inputstream", exc);
}
}
}
@@ -729,7 +731,7 @@
try {
inputStream.close();
} catch(Exception exc) {
-
+ LOG.warn("Error closing InputStream", exc);
}
}
}
@@ -846,7 +848,7 @@
if(inputStream != null)
inputStream.close();
} catch (Exception exc) {
-
+ LOG.warn("Error closing Input stream", exc);
}
}
}
@@ -906,7 +908,7 @@
try {
inputStream.close();
} catch(Exception exc) {
-
+ LOG.warn("Error closing Input stream", exc);
}
}
}
@@ -976,7 +978,7 @@
try {
inputStream.close();
} catch(Exception exc) {
-
+ LOG.warn("Error closing Input stream", exc);
}
}
}
@@ -1208,12 +1210,14 @@
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 @@
try {
u = new URI(url);
} catch (URISyntaxException e) {
+ LOG.warn("URISyntaxException", e);
return false;
}