Skip to content

Commit

Permalink
Merge pull request #4009 from jamezp/RESTEASY-3443
Browse files Browse the repository at this point in the history
[RESTEASY-3443] In the JsonProcessingExceptionMapper currently return…
  • Loading branch information
jamezp committed Feb 6, 2024
2 parents 32d1a82 + 73446c4 commit 3f64acb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public class JsonProcessingExceptionMapper implements ExceptionMapper<JsonProces
@Override
public Response toResponse(final JsonProcessingException exception) {
JacksonLogger.LOGGER.logCannotDeserialize(exception);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(JacksonLogger.LOGGER.cannotDeserialize()).build();
return Response.status(Response.Status.BAD_REQUEST).entity(JacksonLogger.LOGGER.cannotDeserialize()).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void testAircraftFailure() throws Exception {
String response = sendPost(new TestPolymorphicType(new Aircraft()));
logger.info("response: " + response);
Assert.assertNotNull(response);
Assert.assertTrue(response.contains("Response code: " + HttpResponseCodes.SC_INTERNAL_SERVER_ERROR));
Assert.assertTrue(response.contains("Response code: " + HttpResponseCodes.SC_BAD_REQUEST));
Assert.assertTrue("Expected response to contain \"Not able to deserialize data provided\" but was \"" + response + "\"",
response.contains("Not able to deserialize data provided"));
}
Expand All @@ -101,7 +101,7 @@ public void testAutomobileFailure() throws Exception {
String response = sendPost(new TestPolymorphicType(new Automobile()));
logger.info("response: " + response);
Assert.assertNotNull(response);
Assert.assertTrue(response.contains("Response code: " + HttpResponseCodes.SC_INTERNAL_SERVER_ERROR));
Assert.assertTrue(response.contains("Response code: " + HttpResponseCodes.SC_BAD_REQUEST));
Assert.assertTrue("Expected response to contain \"Not able to deserialize data provided\" but was \"" + response + "\"",
response.contains("Not able to deserialize data provided"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void testBad() throws Exception {
String response = sendPost(new TestPolymorphicType(new Aircraft()));
logger.info("response: " + response);
Assert.assertNotNull(response);
Assert.assertTrue(response.contains("Response code: " + HttpResponseCodes.SC_INTERNAL_SERVER_ERROR));
Assert.assertTrue(response.contains("Response code: " + HttpResponseCodes.SC_BAD_REQUEST));
Assert.assertTrue("Expected response to contain \"Not able to deserialize data provided\" but was \"" + response + "\"",
response.contains("Not able to deserialize data provided"));
}
Expand Down

0 comments on commit 3f64acb

Please sign in to comment.