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 2018/09/18 04:35:35 UTC
[isis] branch v2 updated: ISIS-1976: slight optimization to reduce
heap pollution
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch v2
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/v2 by this push:
new 9f4fc55 ISIS-1976: slight optimization to reduce heap pollution
9f4fc55 is described below
commit 9f4fc55b9807b76b2f0b9e84ba396530af23b27f
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Sep 18 06:35:30 2018 +0200
ISIS-1976: slight optimization to reduce heap pollution
Task-Url: https://issues.apache.org/jira/browse/ISIS-1976
---
.../java/org/apache/isis/security/shiro/util/Util.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/core/plugins/security-shiro/src/main/java/org/apache/isis/security/shiro/util/Util.java b/core/plugins/security-shiro/src/main/java/org/apache/isis/security/shiro/util/Util.java
index dd5ffac..a71a35a 100644
--- a/core/plugins/security-shiro/src/main/java/org/apache/isis/security/shiro/util/Util.java
+++ b/core/plugins/security-shiro/src/main/java/org/apache/isis/security/shiro/util/Util.java
@@ -18,6 +18,7 @@
*/
package org.apache.isis.security.shiro.util;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -31,17 +32,22 @@ public class Util {
public static Map<String, Set<String>> parse(String permissionsByRoleStr) {
final Map<String, Set<String>> permsByRole = _Maps.newHashMap();
+ final List<String> roleAndPerms = new ArrayList<>(2);
+
_Strings.splitThenStream(permissionsByRoleStr, ";")
.forEach(roleAndPermsStr->{
- final List<String> roleAndPerms = _Strings.splitThenStream(roleAndPermsStr, "=")
- .collect(Collectors.toList());
+ roleAndPerms.clear();
+
+ _Strings.splitThenStream(roleAndPermsStr, "=")
+ .map(String::trim)
+ .forEach(roleAndPerms::add);
if(roleAndPerms.size() != 2) {
return;
}
- final String role = roleAndPerms.get(0).trim();
- final String permStr = roleAndPerms.get(1).trim();
+ final String role = roleAndPerms.get(0);
+ final String permStr = roleAndPerms.get(1);
final Set<String> perms = _Strings.splitThenStream(permStr, ",")
.map(String::trim)