if (groupValue == null) {
context.setError("Error adding membership", "Group value is null");
return;
}
group = (Group) groupValue;
final Membership membership = Membership.create(user, group);
if (roleExpression != null) {
final Object roleValue = roleExpression.getValue(elContext);
if (roleValue != null) {
final String roleValueString = roleValue.toString();
if (roleValueString.length() > 0) {
membership.setRole(roleValueString);
}
}
}
if (targetExpression != null) {
targetExpression.setValue(elContext, membership);