RestApiServlet: Add a constant for HTTP 422 Change-Id: I4bd2caa1c1198a97f7f3755cc2a2da78ad4a3688
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java index 49d30b4..943d824 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java
@@ -147,6 +147,10 @@ private static final String JSON_TYPE = "application/json"; private static final String FORM_TYPE = "application/x-www-form-urlencoded"; + // HTTP 422 Unprocessable Entity. + // TODO: Remove when HttpServletResponse.SC_UNPROCESSABLE_ENTITY is available + private static final int SC_UNPROCESSABLE_ENTITY = 422; + private static final int HEAP_EST_SIZE = 10 * 8 * 1024; // Presize 10 blocks. /** @@ -394,7 +398,7 @@ responseBytes = replyError(req, res, status = SC_PRECONDITION_FAILED, messageOr(e, "Precondition Failed"), e.caching(), e); } catch (UnprocessableEntityException e) { - responseBytes = replyError(req, res, status = 422, + responseBytes = replyError(req, res, status = SC_UNPROCESSABLE_ENTITY, messageOr(e, "Unprocessable Entity"), e.caching(), e); } catch (NotImplementedException e) { responseBytes = replyError(req, res, status = SC_NOT_IMPLEMENTED,