try {
result = identity.login();
}
catch (UserAlreadyLoggedInException ex) {
throw new AlreadyLoggedInException("Already logged in as "
+ ((org.picketlink.idm.model.basic.User) identity.getAccount()).getLoginName());
}
catch (RuntimeException ex) {
throw new AuthenticationException("An error occurred while authenticating.", ex);
}