Source:
<code>private void invokeServlet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setHeader("Strict-Transport-Security", "max-age=31536000"); log.info("Request received: [" + req.getMethod() + "] " + req.getRequestURL().toString() + ", Params: " + HttpRequestHelper.getRequestParametersAsString(req) + ", Headers: " + HttpRequestHelper.getRequestHeadersAsString(req) + ", Request ID: " + Config.getRequestId()); Action action; try { action = new ActionFactory().getAction(req, req.getMethod(), resp); } catch (ActionMappingException e) { throwError(resp, e.getStatusCode(), e.getMessage()); return; <START> } catch (UnauthorizedAccessException uae) { <END> throwError(resp, HttpStatus.SC_FORBIDDEN, uae.getMessage()); return; } try { action.checkAccessControl(); ActionResult result = action.execute(); result.send(resp); } catch (InvalidHttpParameterException ihpe) { throwError(resp, HttpStatus.SC_BAD_REQUEST, ihpe.getMessage()); } catch (UnauthorizedAccessException uae) { throwError(resp, HttpStatus.SC_FORBIDDEN, uae.getMessage()); } catch (EntityNotFoundException enfe) { throwError(resp, HttpStatus.SC_NOT_FOUND, enfe.getMessage()); } catch (DeadlineExceededException | DatastoreTimeoutException e) { log.severe(e.getClass().getSimpleName() + " caught by WebApiServlet: " + TeammatesException.toStringWithStackTrace(e)); throwError(resp, HttpStatus.SC_GATEWAY_TIMEOUT, e.getMessage()); } catch (Throwable t) { log.severe(t.getClass().getSimpleName() + " caught by WebApiServlet: " + TeammatesException.toStringWithStackTrace(t)); throwError(resp, HttpStatus.SC_INTERNAL_SERVER_ERROR, t.getMessage()); } }</code><technical_language>this here, in fact move entire generation of action object next try block. java try { Action action = new ActionFactory().getAction(req, req.getMethod(), resp); action.checkAccessControl(); ... } catch (ActionMappingException ame) { throwError(resp, ame.getStatusCode(), ame.getMessage()); } catch (...) { ... }</technical_language>

Target:
private void invokeServlet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setHeader("Strict-Transport-Security", "max-age=31536000"); log.info("Request received: [" + req.getMethod() + "] " + req.getRequestURL().toString() + ", Params: " + HttpRequestHelper.getRequestParametersAsString(req) + ", Headers: " + HttpRequestHelper.getRequestHeadersAsString(req) + ", Request ID: " + Config.getRequestId()); try { Action action = new ActionFactory().getAction(req, req.getMethod(), resp); action.checkAccessControl(); ActionResult result = action.execute(); result.send(resp); } catch (ActionMappingException e) { throwError(resp, e.getStatusCode(), e.getMessage()); } catch (InvalidHttpParameterException ihpe) { throwError(resp, HttpStatus.SC_BAD_REQUEST, ihpe.getMessage()); } catch (UnauthorizedAccessException uae) { throwError(resp, HttpStatus.SC_FORBIDDEN, uae.getMessage()); } catch (EntityNotFoundException enfe) { throwError(resp, HttpStatus.SC_NOT_FOUND, enfe.getMessage()); } catch (DeadlineExceededException | DatastoreTimeoutException e) { log.severe(e.getClass().getSimpleName() + " caught by WebApiServlet: " + TeammatesException.toStringWithStackTrace(e)); throwError(resp, HttpStatus.SC_GATEWAY_TIMEOUT, e.getMessage()); } catch (Throwable t) { log.severe(t.getClass().getSimpleName() + " caught by WebApiServlet: " + TeammatesException.toStringWithStackTrace(t)); throwError(resp, HttpStatus.SC_INTERNAL_SERVER_ERROR, t.getMessage()); } }