From db15a1fbc57a162840bcec6710704c64eba4f2fd Mon Sep 17 00:00:00 2001 From: sumit Date: Tue, 8 May 2018 16:57:14 +0530 Subject: [PATCH] Issue #145 feat:More logging in Dao layer --- .../registry/authorization/AuthorizationFilter.java | 6 +++--- .../io/opensaber/registry/dao/impl/RegistryDaoImpl.java | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/java/middleware/registry-middleware/authorization/src/main/java/io/opensaber/registry/authorization/AuthorizationFilter.java b/java/middleware/registry-middleware/authorization/src/main/java/io/opensaber/registry/authorization/AuthorizationFilter.java index 54b0ead6f..c325c7cc1 100644 --- a/java/middleware/registry-middleware/authorization/src/main/java/io/opensaber/registry/authorization/AuthorizationFilter.java +++ b/java/middleware/registry-middleware/authorization/src/main/java/io/opensaber/registry/authorization/AuthorizationFilter.java @@ -51,11 +51,11 @@ public Map execute(Map mapObject) throws Middlew String token = tokenObject.toString(); try { if (!keyCloakServiceImpl.verifyToken(token).trim().isEmpty()) { - /* if(mapObject.containsKey("userName")) { + if (mapObject.containsKey("userName")) { logger.info("Access token for user {} verified successfully with KeyCloak server !", mapObject.get("userName")); - }else {*/ + } else { logger.info("Access token verified successfully with KeyCloak server !"); - // } + } AuthInfo authInfo = extractTokenIntoAuthInfo(token); if (authInfo.getSub() == null || authInfo.getAud() == null || authInfo.getName() == null) { throw new MiddlewareHaltException(TOKEN_IS_INVALID); diff --git a/java/registry/src/main/java/io/opensaber/registry/dao/impl/RegistryDaoImpl.java b/java/registry/src/main/java/io/opensaber/registry/dao/impl/RegistryDaoImpl.java index 563b24212..57c23e6be 100644 --- a/java/registry/src/main/java/io/opensaber/registry/dao/impl/RegistryDaoImpl.java +++ b/java/registry/src/main/java/io/opensaber/registry/dao/impl/RegistryDaoImpl.java @@ -390,7 +390,12 @@ private void verifyAndDelete(Vertex dbSourceVertex, Edge e, Optional edgeA * @throws AuditFailedException */ private void deleteEdgeAndNode(Vertex v, Edge dbEdgeToBeRemoved, Vertex dbVertexToBeDeleted) throws AuditFailedException{ - logger.info("Deleting edge and node for edge-label : {} , vertex-label : {}", dbEdgeToBeRemoved.label(),dbVertexToBeDeleted.label()); + if(dbVertexToBeDeleted !=null) { + logger.info("Deleting edge and node for edge-label : {} , vertex-label : {}", dbEdgeToBeRemoved.label(), dbVertexToBeDeleted.label()); + }else{ + logger.info("Deleting edge and node for edge-label : {} ", dbEdgeToBeRemoved.label()); + } + if(dbVertexToBeDeleted == null){ dbVertexToBeDeleted = dbEdgeToBeRemoved.inVertex(); }