elise-ng / COMP4111_Project

0 stars 0 forks source link

Server return no response updating non-numeric ID book status #22

Closed STommydx closed 4 years ago

STommydx commented 4 years ago

Describe the bug Server return no response updating non-numeric ID book status.

To Reproduce

  1. Login as usual
  2. Update book with a non-numeric ID (e.g. hi) with the payload below. PUT /BookManagementService/books/hi?token={{token}}
    {
    "Available" : true
    }

Expected behaviour 400 Bad Request or 404 Not Found or other custom behaviour that does not crash the server.

What actually happens The server does not produce a response with exception thrown in the console

api_1  | Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: "hi"
api_1  |    at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
api_1  |    at java.base/java.lang.Integer.parseInt(Unknown Source)
api_1  |    at java.base/java.lang.Integer.parseInt(Unknown Source)
api_1  |    at BooksRequestHandler.handleAvailability(BooksRequestHandler.java:180)
api_1  |    at BooksRequestHandler.lambda$handle$0(BooksRequestHandler.java:59)
api_1  |    at java.base/java.lang.Thread.run(Unknown Source)
elise-ng commented 4 years ago

Confirmed. Thanks.