From 9745bfe374fabd8a069c39d49212b513340778e1 Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Wed, 18 Mar 2020 07:40:52 +0100 Subject: [PATCH] consistent usage of Apache http status constants (#2432) --- main/src/com/google/refine/RefineServlet.java | 5 +++-- .../server/src/com/google/refine/RefineServletTests.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main/src/com/google/refine/RefineServlet.java b/main/src/com/google/refine/RefineServlet.java index 8166b5a6c..05f0c3d9b 100644 --- a/main/src/com/google/refine/RefineServlet.java +++ b/main/src/com/google/refine/RefineServlet.java @@ -50,6 +50,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.http.HttpStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -203,10 +204,10 @@ public class RefineServlet extends Butterfly { command.doDelete(request, response); logger.trace("< DELETE {}", commandKey); } else { - response.sendError(405); + response.sendError(HttpStatus.SC_METHOD_NOT_ALLOWED); } } else { - response.sendError(404); + response.sendError(HttpStatus.SC_NOT_FOUND); } } else { super.service(request, response); diff --git a/main/tests/server/src/com/google/refine/RefineServletTests.java b/main/tests/server/src/com/google/refine/RefineServletTests.java index 6eba1997e..c0c158165 100644 --- a/main/tests/server/src/com/google/refine/RefineServletTests.java +++ b/main/tests/server/src/com/google/refine/RefineServletTests.java @@ -44,6 +44,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.http.HttpStatus; import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterMethod; @@ -296,7 +297,7 @@ public class RefineServletTests extends RefineTest { } protected void verifyError404Called(){ try { - verify(response,times(1)).sendError(404); + verify(response,times(1)).sendError(HttpStatus.SC_NOT_FOUND); } catch (IOException e) { Assert.fail(); }