From 479ae71e3fc17839730a32b24575897c0bbed813 Mon Sep 17 00:00:00 2001 From: Norm Traxler Date: Wed, 6 Mar 2019 21:17:26 +0000 Subject: LOG-1001: Errors not logged Issue-ID: LOG-1001 Change-Id: I8f10e58fa42046b099c38f0d55c599622cb1fb29 Signed-off-by: Norm Traxler --- .../aai/service/SpringServiceImpl.java | 2 +- .../aai/service/rs/RestServiceImpl.java | 2 ++ .../pomba/contextbuilder/aai/util/RestUtil.java | 40 ++++++++++++---------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java index cba4aa9..5392c08 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java +++ b/src/main/java/org/onap/pomba/contextbuilder/aai/service/SpringServiceImpl.java @@ -59,7 +59,7 @@ public class SpringServiceImpl implements SpringService { } catch (AuditException ae) { throw ae; } catch (Exception e) { - throw new AuditException(e.getLocalizedMessage()); + throw new AuditException(e.getLocalizedMessage(), e); } return context; } diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java index f5653f2..6542db5 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java +++ b/src/main/java/org/onap/pomba/contextbuilder/aai/service/rs/RestServiceImpl.java @@ -87,6 +87,7 @@ public class RestServiceImpl implements RestService { response = Response.ok().entity(gson.toJson(aaiContext)).build(); } } catch (AuditException ce) { + log.error("getContext failure", ce); if (ce.getHttpStatus() !=null) { response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build(); }else { @@ -94,6 +95,7 @@ public class RestServiceImpl implements RestService { response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(ce.getMessage()).build(); } } catch (Exception e) { + log.error("getContext failure", e); response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java index 928153b..cf28487 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java +++ b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java @@ -658,30 +658,34 @@ public class RestUtil { if (isEmptyJson(pserverPayload)) { log.info(LogMessages.NOT_FOUND, "PSERVER with url", pserverURL); } else { - log.info(String.format("Message from AAI for pserver url %s ,message body: %s", pserverURL, JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(pserverPayload)))); - + log.info("Message from AAI for pserver url {}, message body {}", pserverURL, + JsonUtils.toPrettyJsonString(JsonUtils.jsonToObject(pserverPayload))); // Logic to Create the Pserver POJO object PserverInstance pserverInst = PserverInstance.fromJson(pserverPayload); if ((pserverInst.getPInterfaceInstanceList() != null) - &&(!(pserverInst.getPInterfaceInstanceList().getPInterfaceList().isEmpty()))) { - List pInterfaceInstList_aai = pserverInst.getPInterfaceInstanceList().getPInterfaceList(); - for (PInterfaceInstance pInterfaceInst_aai : pInterfaceInstList_aai) { - //Obtain P-Interface level logical-link - pInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL, - requestId, aaiBasicAuthorization, pInterfaceInst_aai.getRelationshipList())); - - List lInterfaceInstList_aai = pInterfaceInst_aai.getLInterfaceInstanceList().getLInterfaceList(); - for (LInterfaceInstance lInterfaceInst_aai : lInterfaceInstList_aai) { - //Obtain L-Interface level logical-link - lInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai ( aaiClient, baseURL, - requestId, aaiBasicAuthorization, lInterfaceInst_aai.getRelationshipList())); - } - - } + && (!(pserverInst.getPInterfaceInstanceList().getPInterfaceList().isEmpty()))) { + List pInterfaceInstListAai = pserverInst.getPInterfaceInstanceList() + .getPInterfaceList(); + for (PInterfaceInstance pInterfaceInst_aai : pInterfaceInstListAai) { + // Obtain P-Interface level logical-link + pInterfaceInst_aai.setLogicalLinkInstanceList(obtainLogicalLinkInfoFromAai(aaiClient, baseURL, + requestId, aaiBasicAuthorization, pInterfaceInst_aai.getRelationshipList())); + + if (pInterfaceInst_aai.getLInterfaceInstanceList() != null) { + List lInterfaceInstListAai = pInterfaceInst_aai + .getLInterfaceInstanceList().getLInterfaceList(); + for (LInterfaceInstance lInterfaceInstAai : lInterfaceInstListAai) { + // Obtain L-Interface level logical-link + lInterfaceInstAai.setLogicalLinkInstanceList( + obtainLogicalLinkInfoFromAai(aaiClient, baseURL, requestId, + aaiBasicAuthorization, lInterfaceInstAai.getRelationshipList())); + } + } + } } - //update P-Interface if any. + // update P-Interface if any. pserverLst.add(pserverInst); } } -- cgit 1.2.3-korg