private Result handleOAuthProblemException(HttpServletResponse response, OAuthMessage message, String tokenStr, OAuthProblemException ope) {
logOAuthProblem(message, ope, LOG);
try {
OAuthServlet.handleException(response, ope, applicationProperties.getBaseUrl());
} catch (Exception e) {
LOG.error("Failure reporting OAuth error to client", e);
}
if (ope.getProblem().equals(CONSUMER_KEY_UNKNOWN)) {
return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase(Locale.ENGLISH))));
}
if (tokenStr != null) {
return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase(Locale.ENGLISH)), tokenStr));
} else {
return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase(Locale.ENGLISH))));
}
}