You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seams that on local after creating an order with null in the status results in the inventory not working anymore and always returning a 500 code with the server logging: 8:56.287 [qtp1407036358-30] ERROR i.s.o.i.utils.DefaultExceptionMapper - There was an error processing your request. It has been logged (ID: 79674d24bfbafb00) com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: java.util.HashMap["null"])
from the behavior of the online version and the server logs on local that don't seam to notice that the order status is null this issue might be also present on petstore3.swagger.io and not just localhost :)
to reproduce simply get the inventory like so: curl -X GET "http://localhost:8080/api/v3/store/inventory" -H "accept: application/json"
if it returns a 500 you might have already triggered the issue and need to restart the server and try again BUT
if it works create the following order like so:
this can be fixed by not allowing users to create orders and that can be achieved by modifying placeOrder() from OrderController like so:
Before:
public ResponseContext placeOrder(final RequestContext request, final Order order) { if (order == null) { return new ResponseContext() .status(Response.Status.BAD_REQUEST) .entity("No Order provided. Try again?"); }
After:
public ResponseContext placeOrder(final RequestContext request, final Order order) { if (order == null) { return new ResponseContext() .status(Response.Status.BAD_REQUEST) .entity("No Order provided. Try again?"); } else if (order.getStatus() == null) { return new ResponseContext() .status(Response.Status.BAD_REQUEST) .entity("Order status cannot be null. Try again?"); }
Seams that on local after creating an order with null in the status results in the inventory not working anymore and always returning a 500 code with the server logging:
8:56.287 [qtp1407036358-30] ERROR i.s.o.i.utils.DefaultExceptionMapper - There was an error processing your request. It has been logged (ID: 79674d24bfbafb00) com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: java.util.HashMap["null"])
from the behavior of the online version and the server logs on local that don't seam to notice that the order status is null this issue might be also present on petstore3.swagger.io and not just localhost :)
to reproduce simply get the inventory like so:
curl -X GET "http://localhost:8080/api/v3/store/inventory" -H "accept: application/json"
if it returns a 500 you might have already triggered the issue and need to restart the server and try again BUT
if it works create the following order like so:
curl -X POST "http://localhost:8080/api/v3/store/order" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"id\":10,\"petId\":198772,\"quantity\":7,\"shipDate\":\"2021-02-24T08:34:46.244Z\",\"status\":null,\"complete\":true}"
OR
curl -X POST "http://localhost:8080/api/v3/store/order" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"status\":null}"
and try to get the inventory again.
this consistently returns 500 after that faithful order.
The text was updated successfully, but these errors were encountered: