Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x dddea5c0d -> ea1f8892e


another NPE check


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/ea1f8892
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/ea1f8892
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/ea1f8892

Branch: refs/heads/tomee-1.7.x
Commit: ea1f8892e9306dbd637c70bb670762491cf93f4f
Parents: dddea5c
Author: Romain Manni-Bucau <[email protected]>
Authored: Mon Nov 17 15:01:42 2014 +0100
Committer: Romain Manni-Bucau <[email protected]>
Committed: Mon Nov 17 15:01:42 2014 +0100

----------------------------------------------------------------------
 .../org/apache/openejb/rest/ThreadLocalSecurityContext.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/ea1f8892/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalSecurityContext.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalSecurityContext.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalSecurityContext.java
index 338e379..43022a6 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalSecurityContext.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalSecurityContext.java
@@ -41,7 +41,10 @@ public class ThreadLocalSecurityContext extends 
AbstractRestThreadLocalProxy<Sec
     public Principal getUserPrincipal() {
         final Principal callerPrincipal = service().getCallerPrincipal();
         if (callerPrincipal == null) {
-            return get().getUserPrincipal();
+            final SecurityContext securityContext = get();
+            if (securityContext != null) {
+                return securityContext.getUserPrincipal();
+            }
         }
         return callerPrincipal;
     }

Reply via email to