Don't log stacktrace if git over HTTP fails due to wrong password

It's a user error if a wrong password is provided and the Gerrit
administrator doesn't need a stacktrace for this.

Change-Id: Ie370440d8be52b4be4ea4f7d052c843a1e414708
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-06-05 11:13:32 +02:00
parent 61ff9a69ef
commit 3acdb3a837
3 changed files with 33 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ import com.google.gerrit.server.account.AccountManager;
import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.account.AuthRequest;
import com.google.gerrit.server.account.AuthResult;
import com.google.gerrit.server.account.AuthenticationFailedException;
import com.google.gerrit.server.auth.NoSuchUserException;
import com.google.gerrit.server.config.AuthConfig;
import com.google.inject.Inject;
@@ -168,6 +169,10 @@ class ProjectBasicAuthFilter implements Filter {
rsp.sendError(SC_UNAUTHORIZED);
return false;
}
} catch (AuthenticationFailedException e) {
log.warn("Authentication failed for " + username + ": " + e.getMessage());
rsp.sendError(SC_UNAUTHORIZED);
return false;
} catch (AccountException e) {
log.warn("Authentication failed for " + username, e);
rsp.sendError(SC_UNAUTHORIZED);