Browse Source

Add additional book ID check

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.1-alpha
Pekka Helenius 4 years ago
parent
commit
840a8f01d6
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java

+ 4
- 1
bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java View File

@ -204,7 +204,10 @@ public class BookController {
HttpServletResponse responseData
) {
bookId = book.getId();
// NOTE: We have a unique and non-nullable ISBN value for each book.
if (bookId != book.getId()) {
bindingResult.rejectValue("name", "error.user", "Wrong book");
}
if (bindingResult.hasErrors()) {
responseData.setStatus(HttpServletResponse.SC_BAD_REQUEST);


Loading…
Cancel
Save