diff options
author | Switon Tomasz <tomasz.switon@nokia.com> | 2018-06-25 14:49:42 +0200 |
---|---|---|
committer | Switon Tomasz <tomasz.switon@nokia.com> | 2018-06-25 14:49:42 +0200 |
commit | bd2f6f01d9f8fe376dd5689f68305e40785ce94c (patch) | |
tree | 1658ccb068ae015cae70c219356ba2ff6427faf7 /src/main/java/org | |
parent | 68cd3355674d66f8feee3d067960c081581a3911 (diff) |
Fix sonar issues in /crud/service/CrudRestService
Change-Id: Ib221593a6ff9e7fbd355eb4ff97ce6a5d1a5e0e0
Issue-ID: AAI-1241
Signed-off-by: Switon Tomasz <tomasz.switon@nokia.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/onap/crud/service/CrudRestService.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/onap/crud/service/CrudRestService.java b/src/main/java/org/onap/crud/service/CrudRestService.java index 583fee6..35614cf 100644 --- a/src/main/java/org/onap/crud/service/CrudRestService.java +++ b/src/main/java/org/onap/crud/service/CrudRestService.java @@ -22,6 +22,7 @@ package org.onap.crud.service; import java.security.cert.X509Certificate; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -783,7 +784,9 @@ public class CrudRestService { X500Principal subjectDn = clientCert.getSubjectX500Principal(); authUser = subjectDn.toString(); } - isValid = this.auth.validateRequest(authUser.toLowerCase(), action.toString() + ":" + authPolicyFunctionName); + if(null != authUser) { + isValid = this.auth.validateRequest(authUser.toLowerCase(), action.toString() + ":" + authPolicyFunctionName); + } } catch (Exception e) { logResult(action, uri, e); return false; @@ -816,7 +819,7 @@ public class CrudRestService { void logResult(Action op, String uri, Exception e) { - logger.error(CrudServiceMsgs.EXCEPTION_DURING_METHOD_CALL, op.toString(), uri, e.getStackTrace().toString()); + logger.error(CrudServiceMsgs.EXCEPTION_DURING_METHOD_CALL, op.toString(), uri, Arrays.toString(e.getStackTrace())); // Clear the MDC context so that no other transaction inadvertently // uses our transaction id. |