Upgrade Nomulus to latest Closure Rules

Significant technical debt has been eliminated. The latest best
practices are also now adopted for dealing with runfiles and dealing
with files across repositories.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140762937
This commit is contained in:
jart 2016-12-01 12:33:53 -08:00 committed by Ben McIlwain
parent 79a72387ee
commit 59f4984083
28 changed files with 193 additions and 361 deletions

View file

@ -17,7 +17,6 @@ package google.registry.server;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Verify.verify;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
@ -122,12 +121,7 @@ public final class StaticResourceServlet extends HttpServlet {
Optional<Path> doHead(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
verify(req.getRequestURI().startsWith(prefix));
Path file = root.resolve(req.getRequestURI().substring(prefix.length())).normalize();
if (!file.startsWith(root)) {
logger.infofmt("Evil request: %s (%s) (%s + %s)", req.getRequestURI(), file, root, prefix);
rsp.sendError(SC_BAD_REQUEST, "Naughty naughty!");
return Optional.absent();
}
Path file = root.resolve(req.getRequestURI().substring(prefix.length()));
if (!Files.exists(file)) {
logger.infofmt("Not found: %s (%s)", req.getRequestURI(), file);
rsp.sendError(SC_NOT_FOUND, "Not found");