From 355e89252560fcbb27fa9c5d74f4d5658b6f2559 Mon Sep 17 00:00:00 2001 From: Hugo Renard Date: Wed, 23 Mar 2022 15:21:33 +0100 Subject: [PATCH] fix bug when creating user --- src/main/java/sh/libre/scim/core/UserAdapter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/sh/libre/scim/core/UserAdapter.java b/src/main/java/sh/libre/scim/core/UserAdapter.java index bc233cb3b7..86262bf637 100644 --- a/src/main/java/sh/libre/scim/core/UserAdapter.java +++ b/src/main/java/sh/libre/scim/core/UserAdapter.java @@ -100,8 +100,12 @@ public class UserAdapter extends Adapter { user.getGroupsStream().flatMap(g -> g.getRoleMappingsStream()) .filter((r) -> r.getFirstAttribute("scim").equals("true")).map((r) -> r.getName()) .forEach(r -> rolesSet.add(r)); - user.getRoleMappingsStream().filter((r) -> r.getFirstAttribute("scim").equals("true")) - .map((r) -> r.getName()).forEach(r -> rolesSet.add(r)); + // Bug when new user. + try { + user.getRoleMappingsStream().filter((r) -> r.getFirstAttribute("scim").equals("true")) + .map((r) -> r.getName()).forEach(r -> rolesSet.add(r)); + } catch (Exception e) { + } var roles = new String[rolesSet.size()]; rolesSet.toArray(roles); setRoles(roles);