From 3064d937a6300d5f354d83471a520b4e26d2daaa Mon Sep 17 00:00:00 2001 From: ajay priyadarshi Date: Tue, 27 Mar 2018 12:05:09 +0530 Subject: E&R handling in juju-vnfmadapter common/SwitchController.java file name:ExceptionArgs.java Change-Id: Ide5c57a792798240b8121739071300a0e238b51d Issue-ID: VFC-852 Signed-off-by: ajay priyadarshi --- .../vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/EntityUtils.java | 3 ++- .../nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtils.java | 3 ++- .../nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SwitchController.java | 8 +++++++- .../gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgs.java | 3 ++- .../nfvo/vnfm/gvnfm/jujuvnfmadapter/service/process/VnfMgr.java | 6 +++--- .../vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/rest/VnfRoa.java | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/EntityUtils.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/EntityUtils.java index 1cb803c..4056dd7 100644 --- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/EntityUtils.java +++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/EntityUtils.java @@ -288,7 +288,8 @@ public class EntityUtils { public void run() { try { exitValue = process.waitFor(); - } catch(InterruptedException e) { + } catch(Exception e) { + LOG.error("process.waitFor(): ",e); return; } } diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtils.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtils.java index 7cf6418..7dc980d 100644 --- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtils.java +++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtils.java @@ -196,7 +196,8 @@ public class LocalComandUtils { public void run() { try { exitValue = process.waitFor(); - } catch(InterruptedException e) { + } catch(Exception e) { + log.error("process.waitFor(): ",e); return; } } diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SwitchController.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SwitchController.java index 325be7a..bf43464 100644 --- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SwitchController.java +++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SwitchController.java @@ -31,7 +31,7 @@ public class SwitchController { * turn debug model */ private static boolean debugModel = false; - public static String vnfmServiceUrl = null; + private static String vnfmServiceUrl = null; public SwitchController() { //NOSONAR //Constructor @@ -52,4 +52,10 @@ public class SwitchController { SwitchController.debugModel = debugModel; } + public static void setVnfmServiceUrl(String inVnfmServiceUrl) { + SwitchController.vnfmServiceUrl = inVnfmServiceUrl; + } + public static String getVnfmServiceUrl() { + return SwitchController.vnfmServiceUrl; + } } diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgs.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgs.java index 403f89b..a0500de 100644 --- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgs.java +++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgs.java @@ -15,6 +15,7 @@ */ package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.restclient; +import java.io.Serializable; /** * ROA exception handling parameters. @@ -25,7 +26,7 @@ package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.restclient; * @author * @version 28-May-2016 */ -public class ExceptionArgs { +public class ExceptionArgs implements Serializable{ /** * Exception descriptions. diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/process/VnfMgr.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/process/VnfMgr.java index 0fceb1e..9c2e981 100644 --- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/process/VnfMgr.java +++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/process/VnfMgr.java @@ -103,7 +103,7 @@ public class VnfMgr { LOG.warn("the value 'vnfmServiceUrl' not exist."+e.getMessage()); } if (StringUtils.isBlank(url)) { - url = SwitchController.vnfmServiceUrl; + url = SwitchController.getVnfmServiceUrl(); } if (StringUtils.isBlank(url)) { JSONObject vnfmObject = VnfmUtil.getVnfmById(vnfmId); @@ -242,7 +242,7 @@ public class VnfMgr { JSONObject restJson = new JSONObject(); restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL); try { - String url = SwitchController.vnfmServiceUrl; + String url = SwitchController.getVnfmServiceUrl(); if (StringUtils.isBlank(url)) { JSONObject vnfmObject = VnfmUtil.getVnfmById(vnfmId); @@ -305,7 +305,7 @@ public class VnfMgr { JSONObject restJson = new JSONObject(); restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL); try { - String url = SwitchController.vnfmServiceUrl; + String url = SwitchController.getVnfmServiceUrl(); JSONObject vnfmObject = null; if (StringUtils.isBlank(url)) { // call the ESR to get jujuvnfm server url diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/rest/VnfRoa.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/rest/VnfRoa.java index 1f2a97c..98e8a4a 100644 --- a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/rest/VnfRoa.java +++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/rest/VnfRoa.java @@ -95,7 +95,7 @@ public class VnfRoa { result.put("retCode", Constant.REST_SUCCESS); JSONObject reqJsonObject = StringUtil.getJsonFromContexts(context); String vnfmServiceUrl = reqJsonObject.getString("url"); - SwitchController.vnfmServiceUrl = vnfmServiceUrl; + SwitchController.setVnfmServiceUrl(vnfmServiceUrl); LOG.info(reqJsonObject + ":setVNFMInfo success!"); return result.toString(); } -- cgit 1.2.3-korg