} catch (PasswordPolicyException ex) {
try { ugStore.load(); } catch (IOException ex2) {};
throw ex;
}
GeoServerRoleStore roleStore=null;
try {
if (hasRoleStore(getSecurityManager().getActiveRoleService().getName())) {
roleStore = getRoleStore(getSecurityManager().getActiveRoleService().getName());
roleStore = new RoleStoreValidationWrapper(roleStore);
Set<GeoServerRole> orig = roleStore.getRolesForUser(user.getUsername());
Set<GeoServerRole> add = new HashSet<GeoServerRole>();
Set<GeoServerRole> remove = new HashSet<GeoServerRole>();
rolePalette.diff(orig, add, remove);
for (GeoServerRole role : add) {
roleStore.associateRoleToUser(role, user.getUsername());
}
for (GeoServerRole role : remove) {
roleStore.disAssociateRoleFromUser(role, user.getUsername());
}
roleStore.store();
}
} catch (IOException ex) {
try { roleStore.load(); } catch (IOException ex2) {};
throw ex;
}
}