try {
result = identity.login();
}
catch (UserAlreadyLoggedInException ex) {
throw new UserAlreadyLoggedInException("Already logged in as "
+ ((User) identity.getAccount()).getLoginName());
}
catch (RuntimeException ex) {
throw new AuthenticationException("An error occurred during authentication.", ex);
}