From 043f000141590ef5c5944b6d717c7a592df69c47 Mon Sep 17 00:00:00 2001 From: seshukm Date: Mon, 18 Sep 2017 12:58:10 +0530 Subject: Fixed issues in adapter package Issue-Id: SO-141 Change-Id: I1a6905aa7e1328e47b3d0f7580a1dca33c6a069c Signed-off-by: seshukm --- .../openecomp/mso/adapters/vfc/util/RestfulUtil.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'adapters/mso-vfc-adapter') diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java index dfedce8531..8e5f0b4274 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java @@ -130,31 +130,37 @@ public class RestfulUtil { if(httpResponse.getStatusLine().getStatusCode() >= 300) { String errMsg = "VFC returned " + statusCode + " " + statusMessage; logError(errMsg); - return CreateResponse(statusCode, errMsg); + return createResponse(statusCode, errMsg); } httpResponse = null; - method.reset(); + if(null != method) { + method.reset(); + } + else { + LOGGER.debug("method is NULL:"); + } + method = null; LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", ""); - return CreateResponse(statusCode, responseContent); + return createResponse(statusCode, responseContent); } catch(SocketTimeoutException e) { String errMsg = "Request to SDNC timed out"; logError(errMsg, e); - return CreateResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); + return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); } catch(ConnectTimeoutException e) { String errMsg = "Request to SDNC timed out"; logError(errMsg, e); - return CreateResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); + return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); } catch(Exception e) { String errMsg = "Error processing request to SDNC"; logError(errMsg, e); - return CreateResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg); + return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg); } finally { if(httpResponse != null) { @@ -185,7 +191,7 @@ public class RestfulUtil { ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } - private static RestfulResponse CreateResponse(int statusCode, String content) { + private static RestfulResponse createResponse(int statusCode, String content) { RestfulResponse rsp = new RestfulResponse(); rsp.setStatus(statusCode); rsp.setResponseContent(content); -- cgit 1.2.3-korg