fix npe on wrong password

This commit is contained in:
Sebastian Sdorra
2012-08-28 18:34:24 +02:00
parent 761c0b215e
commit 0197eb6f07

View File

@@ -237,11 +237,12 @@ public class ScmRealm extends AuthorizingRealm
authenticator.authenticate(token.getRequest(), token.getResponse(), authenticator.authenticate(token.getRequest(), token.getResponse(),
token.getUsername(), token.getPassword()); token.getUsername(), token.getPassword());
if (result.getState() == AuthenticationState.SUCCESS) if ((result != null) && (AuthenticationState.SUCCESS == result.getState()))
{ {
info = createAuthenticationInfo(token, result); info = createAuthenticationInfo(token, result);
} }
else if (result.getState() == AuthenticationState.NOT_FOUND) else if ((result != null)
&& (AuthenticationState.NOT_FOUND == result.getState()))
{ {
throw new UnknownAccountException( throw new UnknownAccountException(
"unknown account ".concat(token.getUsername())); "unknown account ".concat(token.getUsername()));