Do not log when failure.getError is blank/empty

Sometimes the error message is blank, which results in an empty error line getting logged. 
Since the catch always logs "failed to turn code into token" and "status from server: " + failure.getStatus() (on separate lines) this extra blank line is simply noise in the log.
This commit is contained in:
Peter Sönder 2019-10-15 16:40:11 +02:00 committed by Stian Thorgersen
parent e07fd9ffa3
commit 6c83b36360

View file

@ -336,7 +336,7 @@ public class OAuthRequestAuthenticator {
} catch (ServerRequest.HttpFailure failure) { } catch (ServerRequest.HttpFailure failure) {
log.error("failed to turn code into token"); log.error("failed to turn code into token");
log.error("status from server: " + failure.getStatus()); log.error("status from server: " + failure.getStatus());
if (failure.getError() != null) { if (failure.getError() != null && !failure.getError().isBlank()) {
log.error(" " + failure.getError()); log.error(" " + failure.getError());
} }
return challenge(403, OIDCAuthenticationError.Reason.CODE_TO_TOKEN_FAILURE, null); return challenge(403, OIDCAuthenticationError.Reason.CODE_TO_TOKEN_FAILURE, null);