summaryrefslogtreecommitdiffstats
path: root/nokia
diff options
context:
space:
mode:
authorajay priyadarshi <ajay.priyadarshi@ril.com>2018-03-14 15:54:24 +0530
committerajay priyadarshi <ajay.priyadarshi@ril.com>2018-03-14 15:54:24 +0530
commite9a2ffe8e5e947ca5c408bd7f1f5a45cdc977ff9 (patch)
treedc5015ac6ab0a7c9618bd4638f1c60362092d5b1 /nokia
parent5bd53a3565387aeadabd4514d5350c46292a31b2 (diff)
sonar fix:blocker issues in MsbMgmrImpl
msb/impl/MsbMgmrImpl.java file name: MsbMgmrImpl.java Change-Id: Id4b9bc227819e0a3d657546c87d1182c86801bee Issue-ID: VFC-817 Signed-off-by: ajay priyadarshi <ajay.priyadarshi@ril.com>
Diffstat (limited to 'nokia')
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java59
1 files changed, 30 insertions, 29 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java
index 74fb4395..cd4c7e31 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java
@@ -115,42 +115,43 @@ public class MsbMgmrImpl implements IMsbMgmr {
}
- public String getServiceUrlInMsbBySeriveNameAndVersion(String serviceName, String version) throws ClientProtocolException, IOException {
- String url = adaptorEnv.getMsbApiUriFront() + String.format(CommonConstants.MSB_QUERY_SERVICE_PATH, serviceName, version);
-
- HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.GET, null, null);
-
- String responseStr = httpResult.getContent();
- logger.info("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion, responseStr is " + responseStr);
- String serviceUrl = "";
- if(httpResult.getStatusCode() == 200)
- {
- MsbServiceInfo serviceInfo = gson.fromJson(responseStr, MsbServiceInfo.class);
- if (null == serviceInfo) {
- logger.error("There is no service in MSB for serviceName = {} and version = {}", serviceName, version);
+ public String getServiceUrlInMsbBySeriveNameAndVersion(String serviceName, String version) throws IOException {
+ try{
+ String url = adaptorEnv.getMsbApiUriFront() + String.format(CommonConstants.MSB_QUERY_SERVICE_PATH, serviceName, version);
+
+ HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.GET, null, null);
+
+ String responseStr = httpResult.getContent();
+ logger.info("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion, responseStr is " + responseStr);
+ String serviceUrl = "";
+ if(httpResult.getStatusCode() == 200)
+ {
+ MsbServiceInfo serviceInfo = gson.fromJson(responseStr, MsbServiceInfo.class);
+ if (null == serviceInfo) {
+ logger.error("There is no service in MSB for serviceName = {} and version = {}", serviceName, version);
+ }
+ else{
+ serviceUrl = serviceInfo.getUrl();
+ logger.info("Service Url in MSB for serviceName = {} and version = {} is {}", serviceName, version, serviceUrl);
+ }
}
-
- serviceUrl = serviceInfo.getUrl();
- logger.info("Service Url in MSB for serviceName = {} and version = {} is {}", serviceName, version, serviceUrl);
- }
- else
- {
- logger.error("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion Error, statusCode = " + httpResult.getStatusCode());
- }
+ else
+ {
+ logger.error("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion Error, statusCode = " + httpResult.getStatusCode());
+ }
+
+ return serviceUrl;
+ }catch(Exception e){
+ logger.error("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion Error", e);
+ throw new IOException("getServiceUrlInMsbBySeriveNameAndVersion", e);
- return serviceUrl;
+ }
+
}
public void setAdaptorEnv(AdaptorEnv env) {
this.adaptorEnv = env;
}
-// public static final void main(String[] args) {
-//// MsbMgmrImpl impl = new MsbMgmrImpl();
-//// impl.register();
-// System.setProperty("catalina.base", "D:\\Install\\apache-tomcat-9.0.0.M26");
-// System.out.println(System.getProperty("catalina.base"));
-// }
-
}