Improve consistency of RestApiServlet catch blocks
Use consistent capitalization, as this seems to be what RFC2616 does.
Reorder catch blocks by numeric error code.
Change-Id: I096b6c199b4c92cc8dc2f13ad710b007934596fe
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 634e3e9..5055d47 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
@@ -343,35 +343,35 @@
replyJson(req, res, config, result);
}
}
- } catch (AuthException e) {
- replyError(req, res, status = SC_FORBIDDEN, messageOr(e, "Forbidden"),
- e.caching(), e);
- } catch (BadRequestException e) {
- replyError(req, res, status = SC_BAD_REQUEST, messageOr(e, "Bad request"),
- e.caching(), e);
- } catch (MethodNotAllowedException e) {
- replyError(req, res, status = SC_METHOD_NOT_ALLOWED,
- messageOr(e, "Method not allowed"), e.caching(), e);
- } catch (ResourceConflictException e) {
- replyError(req, res, status = SC_CONFLICT, messageOr(e, "Conflict"),
- e.caching(), e);
- } catch (PreconditionFailedException e) {
- replyError(req, res, status = SC_PRECONDITION_FAILED,
- messageOr(e, "Precondition failed"), e.caching(), e);
- } catch (ResourceNotFoundException e) {
- replyError(req, res, status = SC_NOT_FOUND, messageOr(e, "Not found"),
- e.caching(), e);
- } catch (UnprocessableEntityException e) {
- replyError(req, res, status = 422, messageOr(e, "Unprocessable Entity"),
- e.caching(), e);
- } catch (AmbiguousViewException e) {
- replyError(req, res, status = SC_NOT_FOUND, messageOr(e, "Ambiguous"), e);
} catch (MalformedJsonException e) {
replyError(req, res, status = SC_BAD_REQUEST,
"Invalid " + JSON_TYPE + " in request", e);
} catch (JsonParseException e) {
replyError(req, res, status = SC_BAD_REQUEST,
"Invalid " + JSON_TYPE + " in request", e);
+ } catch (BadRequestException e) {
+ replyError(req, res, status = SC_BAD_REQUEST, messageOr(e, "Bad Request"),
+ e.caching(), e);
+ } catch (AuthException e) {
+ replyError(req, res, status = SC_FORBIDDEN, messageOr(e, "Forbidden"),
+ e.caching(), e);
+ } catch (AmbiguousViewException e) {
+ replyError(req, res, status = SC_NOT_FOUND, messageOr(e, "Ambiguous"), e);
+ } catch (ResourceNotFoundException e) {
+ replyError(req, res, status = SC_NOT_FOUND, messageOr(e, "Not Found"),
+ e.caching(), e);
+ } catch (MethodNotAllowedException e) {
+ replyError(req, res, status = SC_METHOD_NOT_ALLOWED,
+ messageOr(e, "Method Not Allowed"), e.caching(), e);
+ } catch (ResourceConflictException e) {
+ replyError(req, res, status = SC_CONFLICT, messageOr(e, "Conflict"),
+ e.caching(), e);
+ } catch (PreconditionFailedException e) {
+ replyError(req, res, status = SC_PRECONDITION_FAILED,
+ messageOr(e, "Precondition Failed"), e.caching(), e);
+ } catch (UnprocessableEntityException e) {
+ replyError(req, res, status = 422, messageOr(e, "Unprocessable Entity"),
+ e.caching(), e);
} catch (Exception e) {
status = SC_INTERNAL_SERVER_ERROR;
handleException(e, req, res);