aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-01-31 13:37:38 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-31 13:37:38 +0000
commit159f3d829424fad2519fddfd88b8b9b0c45a2da9 (patch)
treea2c5ae27c5c9a6bfb3e2df1f75d5840fde7c92c3
parent59eccd12f38c957099dcc7ec728c34deb0d74758 (diff)
parent5d4080b4ebb5119e00b2ddf813af3de8e81aafaf (diff)
Merge "Fixed major sonar issue in AAIService.java"
-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;
}