Remove superfluous final from gerrit/httpd/

Change-Id: I7f576ea09824944d33d6f422324d2337cc9bf4e5
This commit is contained in:
Han-Wen Nienhuys 2017-06-13 16:51:38 +02:00
parent 1a2f731637
commit 4d7645378e
11 changed files with 41 additions and 41 deletions

@ -97,7 +97,7 @@ public abstract class AllRequestFilter implements Filter {
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, final FilterChain last)
public void doFilter(ServletRequest req, ServletResponse res, FilterChain last)
throws IOException, ServletException {
final Iterator<AllRequestFilter> itr = filters.iterator();
new FilterChain() {

@ -56,12 +56,12 @@ public abstract class CacheBasedWebSession implements WebSession {
private CurrentUser user;
protected CacheBasedWebSession(
final HttpServletRequest request,
final HttpServletResponse response,
final WebSessionManager manager,
final AuthConfig authConfig,
final Provider<AnonymousUser> anonymousProvider,
final IdentifiedUser.RequestFactory identified) {
HttpServletRequest request,
HttpServletResponse response,
WebSessionManager manager,
AuthConfig authConfig,
Provider<AnonymousUser> anonymousProvider,
IdentifiedUser.RequestFactory identified) {
this.request = request;
this.response = response;
this.manager = manager;
@ -91,7 +91,7 @@ public abstract class CacheBasedWebSession implements WebSession {
private String readCookie() {
final Cookie[] all = request.getCookies();
if (all != null) {
for (final Cookie c : all) {
for (Cookie c : all) {
if (ACCOUNT_COOKIE.equals(c.getName())) {
final String v = c.getValue();
return v != null && !"".equals(v) ? v : null;
@ -229,7 +229,7 @@ public abstract class CacheBasedWebSession implements WebSession {
response.addCookie(outCookie);
}
private static boolean isSecure(final HttpServletRequest req) {
private static boolean isSecure(HttpServletRequest req) {
return req.isSecure() || "https".equals(req.getScheme());
}
}

@ -32,14 +32,14 @@ class CookieBase64 {
enc[o] = '.';
}
private static int fill(final char[] out, int o, final char f, final int l) {
private static int fill(char[] out, int o, char f, int l) {
for (char c = f; c <= l; c++) {
out[o++] = c;
}
return o;
}
static String encode(final byte[] in) {
static String encode(byte[] in) {
final StringBuilder out = new StringBuilder(in.length * 4 / 3);
final int len2 = in.length - 2;
int d = 0;
@ -53,7 +53,7 @@ class CookieBase64 {
}
private static void encode3to4(
final StringBuilder out, final byte[] in, final int inOffset, final int numSigBytes) {
StringBuilder out, byte[] in, int inOffset, int numSigBytes) {
// 1 2 3
// 01234567890123456789012345678901 Bit position
// --------000000001111111122222222 Array position from threeBytes

@ -41,7 +41,7 @@ public class GetUserFilter implements Filter {
private final boolean enabled;
@Inject
Module(@GerritServerConfig final Config cfg) {
Module(@GerritServerConfig Config cfg) {
enabled = cfg.getBoolean("http", "addUserAsRequestAttribute", true);
}
@ -56,7 +56,7 @@ public class GetUserFilter implements Filter {
private final Provider<CurrentUser> userProvider;
@Inject
GetUserFilter(final Provider<CurrentUser> userProvider) {
GetUserFilter(Provider<CurrentUser> userProvider) {
this.userProvider = userProvider;
}

@ -28,12 +28,12 @@ public class HttpCanonicalWebUrlProvider extends CanonicalWebUrlProvider {
private Provider<HttpServletRequest> requestProvider;
@Inject
HttpCanonicalWebUrlProvider(@GerritServerConfig final Config config) {
HttpCanonicalWebUrlProvider(@GerritServerConfig Config config) {
super(config);
}
@Inject(optional = true)
public void setHttpServletRequest(final Provider<HttpServletRequest> hsr) {
public void setHttpServletRequest(Provider<HttpServletRequest> hsr) {
requestProvider = hsr;
}

@ -42,17 +42,17 @@ public class HttpLogoutServlet extends HttpServlet {
@Inject
protected HttpLogoutServlet(
final AuthConfig authConfig,
final DynamicItem<WebSession> webSession,
@CanonicalWebUrl @Nullable final Provider<String> urlProvider,
final AuditService audit) {
AuthConfig authConfig,
DynamicItem<WebSession> webSession,
@CanonicalWebUrl @Nullable Provider<String> urlProvider,
AuditService audit) {
this.webSession = webSession;
this.urlProvider = urlProvider;
this.logoutUrl = authConfig.getLogoutURL();
this.audit = audit;
}
protected void doLogout(final HttpServletRequest req, final HttpServletResponse rsp)
protected void doLogout(HttpServletRequest req, HttpServletResponse rsp)
throws IOException {
webSession.get().logout();
if (logoutUrl != null) {
@ -73,7 +73,7 @@ public class HttpLogoutServlet extends HttpServlet {
}
@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse rsp)
protected void doGet(HttpServletRequest req, HttpServletResponse rsp)
throws IOException {
final String sid = webSession.get().getSessionId();

@ -29,7 +29,7 @@ class HttpRemotePeerProvider implements Provider<SocketAddress> {
private final HttpServletRequest req;
@Inject
HttpRemotePeerProvider(final HttpServletRequest r) {
HttpRemotePeerProvider(HttpServletRequest r) {
req = r;
}

@ -48,9 +48,9 @@ public class RequestContextFilter implements Filter {
@Inject
RequestContextFilter(
final Provider<RequestCleanup> r,
final Provider<HttpRequestContext> c,
final ThreadLocalRequestContext l) {
Provider<RequestCleanup> r,
Provider<HttpRequestContext> c,
ThreadLocalRequestContext l) {
cleanup = r;
requestContext = c;
local = l;
@ -64,7 +64,7 @@ public class RequestContextFilter implements Filter {
@Override
public void doFilter(
final ServletRequest request, final ServletResponse response, final FilterChain chain)
ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
RequestContext old = local.setContext(requestContext.get());
try {

@ -52,7 +52,7 @@ public class RequireSslFilter implements Filter {
private final Provider<String> urlProvider;
@Inject
RequireSslFilter(@CanonicalWebUrl @Nullable final Provider<String> urlProvider) {
RequireSslFilter(@CanonicalWebUrl @Nullable Provider<String> urlProvider) {
this.urlProvider = urlProvider;
}
@ -64,7 +64,7 @@ public class RequireSslFilter implements Filter {
@Override
public void doFilter(
final ServletRequest request, final ServletResponse response, final FilterChain chain)
ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest req = (HttpServletRequest) request;
final HttpServletResponse rsp = (HttpServletResponse) response;
@ -91,11 +91,11 @@ public class RequireSslFilter implements Filter {
}
}
private static boolean isSecure(final HttpServletRequest req) {
private static boolean isSecure(HttpServletRequest req) {
return "https".equals(req.getScheme()) || req.isSecure();
}
private static boolean isLocalHost(final HttpServletRequest req) {
private static boolean isLocalHost(HttpServletRequest req) {
return "localhost".equals(req.getServerName()) || "127.0.0.1".equals(req.getServerName());
}
}

@ -265,7 +265,7 @@ class UrlModule extends ServletModule {
}
static void toGerrit(
final String target, final HttpServletRequest req, final HttpServletResponse rsp)
String target, HttpServletRequest req, HttpServletResponse rsp)
throws IOException {
final StringBuilder url = new StringBuilder();
url.append(req.getContextPath());

@ -55,7 +55,7 @@ public class WebSessionManager {
private final Cache<String, Val> self;
@Inject
WebSessionManager(@GerritServerConfig Config cfg, @Assisted final Cache<String, Val> cache) {
WebSessionManager(@GerritServerConfig Config cfg, @Assisted Cache<String, Val> cache) {
prng = new SecureRandom();
self = cache;
@ -76,11 +76,11 @@ public class WebSessionManager {
}
}
Key createKey(final Account.Id who) {
Key createKey(Account.Id who) {
return new Key(newUniqueToken(who));
}
private String newUniqueToken(final Account.Id who) {
private String newUniqueToken(Account.Id who) {
try {
final int nonceLen = 20;
final ByteArrayOutputStream buf;
@ -135,7 +135,7 @@ public class WebSessionManager {
return val;
}
int getCookieAge(final Val val) {
int getCookieAge(Val val) {
if (val.isPersistentCookie()) {
// Client may store the cookie until we would remove it from our
// own cache, after which it will certainly be invalid.
@ -150,7 +150,7 @@ public class WebSessionManager {
return -1;
}
Val get(final Key key) {
Val get(Key key) {
Val val = self.getIfPresent(key.token);
if (val != null && val.expiresAt <= nowMs()) {
self.invalidate(key.token);
@ -159,14 +159,14 @@ public class WebSessionManager {
return val;
}
void destroy(final Key key) {
void destroy(Key key) {
self.invalidate(key.token);
}
static final class Key {
private transient String token;
Key(final String t) {
Key(String t) {
token = t;
}
@ -241,7 +241,7 @@ public class WebSessionManager {
return persistentCookie;
}
private void writeObject(final ObjectOutputStream out) throws IOException {
private void writeObject(ObjectOutputStream out) throws IOException {
writeVarInt32(out, 1);
writeVarInt32(out, accountId.get());
@ -272,7 +272,7 @@ public class WebSessionManager {
writeVarInt32(out, 0);
}
private void readObject(final ObjectInputStream in) throws IOException {
private void readObject(ObjectInputStream in) throws IOException {
PARSE:
for (; ; ) {
final int tag = readVarInt32(in);