You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/01/27 13:28:15 UTC

[isis] branch master updated: ISIS-2158: IsisPermission: clean-up thread-local

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 34c50f5  ISIS-2158: IsisPermission: clean-up thread-local
34c50f5 is described below

commit 34c50f5d847beb2de1f41d98967adc8f7f9cbc82
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Jan 27 14:28:02 2020 +0100

    ISIS-2158: IsisPermission: clean-up thread-local
---
 .../apache/isis/security/shiro/authorization/IsisPermission.java  | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/security/shiro/src/main/java/org/apache/isis/security/shiro/authorization/IsisPermission.java b/security/shiro/src/main/java/org/apache/isis/security/shiro/authorization/IsisPermission.java
index ca16d93..436142e 100644
--- a/security/shiro/src/main/java/org/apache/isis/security/shiro/authorization/IsisPermission.java
+++ b/security/shiro/src/main/java/org/apache/isis/security/shiro/authorization/IsisPermission.java
@@ -34,13 +34,11 @@ public class IsisPermission extends WildcardPermission {
     private static final long serialVersionUID = 1L;
     private static final Pattern PATTERN = Pattern.compile("([!]?)([^/]+)[/](.+)");
 
-    private static ThreadLocal<Map<String,List<IsisPermission>>> VETOING_PERMISSIONS = new ThreadLocal<Map<String,List<IsisPermission>>>() {
-        @Override
-        protected java.util.Map<String,List<IsisPermission>> initialValue() { return _Maps.newTreeMap(); }
-    };
+    private static ThreadLocal<Map<String,List<IsisPermission>>> VETOING_PERMISSIONS = 
+            ThreadLocal.withInitial(_Maps::newTreeMap);
 
     public static void resetVetoedPermissions() {
-        IsisPermission.VETOING_PERMISSIONS.get().clear();
+        IsisPermission.VETOING_PERMISSIONS.remove();
     }
 
     static boolean isVetoed(String permissionGroup, Permission p) {