diff --git a/src/main/java/org/ntlab/citrusserver/resources/FavoritedRest.java b/src/main/java/org/ntlab/citrusserver/resources/FavoritedRest.java index f08a467..f816691 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/FavoritedRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/FavoritedRest.java @@ -45,7 +45,7 @@ //accountID存在確認 if(accountManager.getAccount(account_id) != null) { //other_account_id存在確認 - if(accountManager.getAccount(other_account_id) != null){ + if (accountManager.getAccount(other_account_id) != null) { //book_id存在確認 if (bookManager.getBook(account_id, book_id) != null) { //token認証 @@ -57,19 +57,21 @@ var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗"); throw new WebApplicationException(response.build()); } + } else { //本が存在しない時に対するエラー表示 var response = Response.status(Response.Status.NOT_FOUND).entity("本が存在しません"); throw new WebApplicationException(response.build()); } + } else { //other_account_idが存在しない時に対するエラー表示 var response = Response.status(Response.Status.NOT_FOUND).entity("accountが存在しません"); throw new WebApplicationException(response.build()); } + }else{ //account_idが存在しない時に対するエラー表示 var response = Response.status(Response.Status.NOT_FOUND).entity("accountが存在しません"); throw new WebApplicationException(response.build()); } - } @Path("/{account_id}/books/{book_id}/favorited/{other_account_id}") @@ -77,28 +79,31 @@ @Produces(MediaType.APPLICATION_FORM_URLENCODED) public void removeFavorited(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id, @PathParam("other_account_id") String other_account_id, @QueryParam("token") String token){ //account存在確認 - if(accountManager.getAccount(account_id) != null){ + if(accountManager.getAccount(account_id) != null) { //other_account_id存在確認 - if(accountManager.getAccount(other_account_id) != null){ + if (accountManager.getAccount(other_account_id) != null) { //book_id存在確認 - if(bookManager.getBook(account_id,book_id) != null){ + if (bookManager.getBook(account_id, book_id) != null) { //token承認 - if(accountManager.checkToken(other_account_id,token)) { + if (accountManager.checkToken(other_account_id, token)) { favoriteManager.removeFavorited(account_id, book_id, other_account_id); favoriteManager.removeFavorites(other_account_id, account_id, book_id);//変更点(要検討) - }else{ + } else { //tokenが承認しないときに対するエラー表示 var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗"); throw new WebApplicationException(response.build()); } + } else { //本が存在しない時に対するエラー表示 var response = Response.status(Response.Status.NOT_FOUND).entity("本が存在しません"); throw new WebApplicationException(response.build()); } + } else { //other_account_idが存在しない時に対するエラー表示 var response = Response.status(Response.Status.NOT_FOUND).entity("accountが存在しません"); throw new WebApplicationException(response.build()); } + }else{ //accountが存在しない時に対するエラー表示 var response = Response.status(Response.Status.NOT_FOUND).entity("accountが存在しません"); throw new WebApplicationException(response.build());