LfsPluginServlet#service: Remove unreachable block
The call to chain.doFilter will not be reached; if filter is null the method returns early, and if not null the previous branch of the if- block is entered. Also move the initialization of chain into the constructor so it's only done once. Change-Id: I285242bdfcaebc1f9df72d0d3943b7e1b22da80a
This commit is contained in:
@@ -57,11 +57,20 @@ public class LfsPluginServlet extends HttpServlet
|
||||
|
||||
private List<Plugin> pending = new ArrayList<>();
|
||||
private final String pluginName;
|
||||
private final FilterChain chain;
|
||||
private GuiceFilter filter;
|
||||
|
||||
@Inject
|
||||
LfsPluginServlet(@GerritServerConfig Config cfg) {
|
||||
this.pluginName = cfg.getString("lfs", null, "plugin");
|
||||
this.chain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res)
|
||||
throws IOException {
|
||||
Resource.NOT_FOUND.send(
|
||||
(HttpServletRequest) req, (HttpServletResponse) res);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,19 +81,7 @@ public class LfsPluginServlet extends HttpServlet
|
||||
res.sendError(SC_NOT_IMPLEMENTED);
|
||||
return;
|
||||
}
|
||||
|
||||
FilterChain chain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res)
|
||||
throws IOException {
|
||||
Resource.NOT_FOUND.send((HttpServletRequest) req, (HttpServletResponse) res);
|
||||
}
|
||||
};
|
||||
if (filter != null) {
|
||||
filter.doFilter(req, res, chain);
|
||||
} else {
|
||||
chain.doFilter(req, res);
|
||||
}
|
||||
filter.doFilter(req, res, chain);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user