Enable and fix 'Statement unnecessarily nested within else clause' warnings

Change-Id: Ida6df4593fc2ab3c11581309b2b4a638229ea093
This commit is contained in:
David Pursehouse
2016-06-01 21:20:02 +09:00
parent b88b47d4b1
commit 323247227d
132 changed files with 542 additions and 724 deletions

View File

@@ -109,24 +109,22 @@ class OAuthSession {
log.debug("Login-SUCCESS " + this);
authenticateAndRedirect(request, response);
return true;
} else {
response.sendError(SC_UNAUTHORIZED);
return false;
}
} else {
log.debug("Login-PHASE1 " + this);
redirectToken = request.getRequestURI();
// We are here in content of filter.
// Due to this Jetty limitation:
// https://bz.apache.org/bugzilla/show_bug.cgi?id=28323
// we cannot use LoginUrlToken.getToken() method,
// because it relies on getPathInfo() and it is always null here.
redirectToken = redirectToken.substring(
request.getContextPath().length());
response.sendRedirect(oauth.getAuthorizationUrl() +
"&state=" + state);
response.sendError(SC_UNAUTHORIZED);
return false;
}
log.debug("Login-PHASE1 " + this);
redirectToken = request.getRequestURI();
// We are here in content of filter.
// Due to this Jetty limitation:
// https://bz.apache.org/bugzilla/show_bug.cgi?id=28323
// we cannot use LoginUrlToken.getToken() method,
// because it relies on getPathInfo() and it is always null here.
redirectToken = redirectToken.substring(
request.getContextPath().length());
response.sendRedirect(oauth.getAuthorizationUrl() +
"&state=" + state);
return false;
}
private void authenticateAndRedirect(HttpServletRequest req,

View File

@@ -101,13 +101,12 @@ class OAuthWebFilter implements Filter {
if (service == null && Strings.isNullOrEmpty(provider)) {
selectProvider(httpRequest, httpResponse, null);
return;
} else {
if (service == null) {
service = findService(provider);
}
oauthSession.setServiceProvider(service);
oauthSession.login(httpRequest, httpResponse, service);
}
if (service == null) {
service = findService(provider);
}
oauthSession.setServiceProvider(service);
oauthSession.login(httpRequest, httpResponse, service);
} else {
chain.doFilter(httpRequest, response);
}