diff options
author | Tian Lee <TianL@amdocs.com> | 2018-06-27 10:41:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-06-27 10:41:13 +0000 |
commit | d7acebd26bf5380c21e654bd0e562b96283a5873 (patch) | |
tree | e5f6ed21e17782fd1b61fd2c6d95152feac7c819 /src/main | |
parent | d10a218c76633374f083f7a2802c198e93a6abae (diff) | |
parent | bd2f6f01d9f8fe376dd5689f68305e40785ce94c (diff) |
Merge "Fix sonar issues in /crud/service/CrudRestService"
Diffstat (limited to 'src/main')
-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 a43d7e5..25ab43a 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; @@ -786,7 +787,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; @@ -819,7 +822,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. |