{"action":"created","comment":{"url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/comments/70050387","id":70050387,"diff_hunk":"@@ -64,12 +64,51 @@ public void delete(@PathParam(\"id\") LongParam id) {\n     @Consumes({MediaType.APPLICATION_JSON})\n     @Produces({MediaType.APPLICATION_JSON})\n     public boolean update(@PathParam(\"id\") LongParam id, Food food) {\n-        if (foodDao.exists(id.get())) {\n-            foodDao.update(id.get(), food);\n-            return true;\n-        } else {\n-            return false;\n+        throwIfFoodNotFound(id.get());\n+        food = fillNullFieldsWithOriginalValues(id.get(), food);\n+        foodDao.update(id.get(), food);\n+        return true;\n+    }\n+\n+\n+    /**\n+     * Throw BadRequestException if food with given foodId doesn't exist.\n+     * Client will receive a response (400 Bad Request) with an error message.\n+     *\n+     * @param foodId Food identifier\n+     */\n+    private void throwIfFoodNotFound(Long foodId) {\n+        if (!foodDao.exists(foodId)) {\n+            String message = \"Food with id = \" + foodId + \" does not exist\";\n+            logger.debug(message);\n+            throw new BadRequestException(message);\n         }\n     }\n \n-}\n+    /**\n+     * Prevent updated Food from having null fields that appear when some values were unspecified\n+     *\n+     * @param originalFoodId Id of food which fields will fill any null values\n+     * @param originalFoodId Id of food which fields will fill any null values","path":"Microservices/FoodService/src/main/java/com/kainos/apigateways/aws/demo/food/resources/FoodResource.java","position":null,"original_position":105,"commit_id":"cf809ee13865cd1538152c668dc8634d8437b863","original_commit_id":"9cfdb0222eb7dd148badb2a7711c6108bca966ca","user":{"login":"adrianz-kainos","id":20107321,"avatar_url":"https://avatars.githubusercontent.com/u/20107321?v=3","gravatar_id":"","url":"https://api.github.com/users/adrianz-kainos","html_url":"https://github.com/adrianz-kainos","followers_url":"https://api.github.com/users/adrianz-kainos/followers","following_url":"https://api.github.com/users/adrianz-kainos/following{/other_user}","gists_url":"https://api.github.com/users/adrianz-kainos/gists{/gist_id}","starred_url":"https://api.github.com/users/adrianz-kainos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrianz-kainos/subscriptions","organizations_url":"https://api.github.com/users/adrianz-kainos/orgs","repos_url":"https://api.github.com/users/adrianz-kainos/repos","events_url":"https://api.github.com/users/adrianz-kainos/events{/privacy}","received_events_url":"https://api.github.com/users/adrianz-kainos/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-07-08T09:49:06Z","updated_at":"2016-07-08T09:49:06Z","html_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo/pull/1#discussion_r70050387","pull_request_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/comments/70050387"},"html":{"href":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo/pull/1#discussion_r70050387"},"pull_request":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/1","id":76600488,"html_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo/pull/1","diff_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo/pull/1.diff","patch_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo/pull/1.patch","issue_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues/1","number":1,"state":"open","locked":false,"title":"Feature/exceptions and logging for resources","user":{"login":"adrianz-kainos","id":20107321,"avatar_url":"https://avatars.githubusercontent.com/u/20107321?v=3","gravatar_id":"","url":"https://api.github.com/users/adrianz-kainos","html_url":"https://github.com/adrianz-kainos","followers_url":"https://api.github.com/users/adrianz-kainos/followers","following_url":"https://api.github.com/users/adrianz-kainos/following{/other_user}","gists_url":"https://api.github.com/users/adrianz-kainos/gists{/gist_id}","starred_url":"https://api.github.com/users/adrianz-kainos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrianz-kainos/subscriptions","organizations_url":"https://api.github.com/users/adrianz-kainos/orgs","repos_url":"https://api.github.com/users/adrianz-kainos/repos","events_url":"https://api.github.com/users/adrianz-kainos/events{/privacy}","received_events_url":"https://api.github.com/users/adrianz-kainos/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-07T14:04:08Z","updated_at":"2016-07-08T09:49:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e6a0e8dddbf083666d6bea03d8e893d9c03be719","assignee":{"login":"xjedam","id":1146446,"avatar_url":"https://avatars.githubusercontent.com/u/1146446?v=3","gravatar_id":"","url":"https://api.github.com/users/xjedam","html_url":"https://github.com/xjedam","followers_url":"https://api.github.com/users/xjedam/followers","following_url":"https://api.github.com/users/xjedam/following{/other_user}","gists_url":"https://api.github.com/users/xjedam/gists{/gist_id}","starred_url":"https://api.github.com/users/xjedam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xjedam/subscriptions","organizations_url":"https://api.github.com/users/xjedam/orgs","repos_url":"https://api.github.com/users/xjedam/repos","events_url":"https://api.github.com/users/xjedam/events{/privacy}","received_events_url":"https://api.github.com/users/xjedam/received_events","type":"User","site_admin":false},"assignees":[{"login":"xjedam","id":1146446,"avatar_url":"https://avatars.githubusercontent.com/u/1146446?v=3","gravatar_id":"","url":"https://api.github.com/users/xjedam","html_url":"https://github.com/xjedam","followers_url":"https://api.github.com/users/xjedam/followers","following_url":"https://api.github.com/users/xjedam/following{/other_user}","gists_url":"https://api.github.com/users/xjedam/gists{/gist_id}","starred_url":"https://api.github.com/users/xjedam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xjedam/subscriptions","organizations_url":"https://api.github.com/users/xjedam/orgs","repos_url":"https://api.github.com/users/xjedam/repos","events_url":"https://api.github.com/users/xjedam/events{/privacy}","received_events_url":"https://api.github.com/users/xjedam/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/1/commits","review_comments_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/1/comments","review_comment_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues/1/comments","statuses_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/statuses/cf809ee13865cd1538152c668dc8634d8437b863","head":{"label":"KainosSoftwareLtd:feature/exceptions-and-logging-for-resources","ref":"feature/exceptions-and-logging-for-resources","sha":"cf809ee13865cd1538152c668dc8634d8437b863","user":{"login":"KainosSoftwareLtd","id":1921909,"avatar_url":"https://avatars.githubusercontent.com/u/1921909?v=3","gravatar_id":"","url":"https://api.github.com/users/KainosSoftwareLtd","html_url":"https://github.com/KainosSoftwareLtd","followers_url":"https://api.github.com/users/KainosSoftwareLtd/followers","following_url":"https://api.github.com/users/KainosSoftwareLtd/following{/other_user}","gists_url":"https://api.github.com/users/KainosSoftwareLtd/gists{/gist_id}","starred_url":"https://api.github.com/users/KainosSoftwareLtd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KainosSoftwareLtd/subscriptions","organizations_url":"https://api.github.com/users/KainosSoftwareLtd/orgs","repos_url":"https://api.github.com/users/KainosSoftwareLtd/repos","events_url":"https://api.github.com/users/KainosSoftwareLtd/events{/privacy}","received_events_url":"https://api.github.com/users/KainosSoftwareLtd/received_events","type":"Organization","site_admin":false},"repo":{"id":61878724,"name":"aws-api-gateway-demo","full_name":"KainosSoftwareLtd/aws-api-gateway-demo","owner":{"login":"KainosSoftwareLtd","id":1921909,"avatar_url":"https://avatars.githubusercontent.com/u/1921909?v=3","gravatar_id":"","url":"https://api.github.com/users/KainosSoftwareLtd","html_url":"https://github.com/KainosSoftwareLtd","followers_url":"https://api.github.com/users/KainosSoftwareLtd/followers","following_url":"https://api.github.com/users/KainosSoftwareLtd/following{/other_user}","gists_url":"https://api.github.com/users/KainosSoftwareLtd/gists{/gist_id}","starred_url":"https://api.github.com/users/KainosSoftwareLtd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KainosSoftwareLtd/subscriptions","organizations_url":"https://api.github.com/users/KainosSoftwareLtd/orgs","repos_url":"https://api.github.com/users/KainosSoftwareLtd/repos","events_url":"https://api.github.com/users/KainosSoftwareLtd/events{/privacy}","received_events_url":"https://api.github.com/users/KainosSoftwareLtd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo","description":null,"fork":false,"url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo","forks_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/forks","keys_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/teams","hooks_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/hooks","issue_events_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues/events{/number}","events_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/events","assignees_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/assignees{/user}","branches_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/branches{/branch}","tags_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/tags","blobs_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/refs{/sha}","trees_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/statuses/{sha}","languages_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/languages","stargazers_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/stargazers","contributors_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/contributors","subscribers_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/subscribers","subscription_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/subscription","commits_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/commits{/sha}","git_commits_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/commits{/sha}","comments_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/comments{/number}","issue_comment_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues/comments{/number}","contents_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/contents/{+path}","compare_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/merges","archive_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/downloads","issues_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues{/number}","pulls_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls{/number}","milestones_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/milestones{/number}","notifications_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/labels{/name}","releases_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/releases{/id}","deployments_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/deployments","created_at":"2016-06-24T11:03:45Z","updated_at":"2016-06-24T11:59:37Z","pushed_at":"2016-07-08T07:59:15Z","git_url":"git://github.com/KainosSoftwareLtd/aws-api-gateway-demo.git","ssh_url":"git@github.com:KainosSoftwareLtd/aws-api-gateway-demo.git","clone_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo.git","svn_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo","homepage":null,"size":55,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"KainosSoftwareLtd:master","ref":"master","sha":"4461d897ce775b55c32e5e000c967cfa955e905b","user":{"login":"KainosSoftwareLtd","id":1921909,"avatar_url":"https://avatars.githubusercontent.com/u/1921909?v=3","gravatar_id":"","url":"https://api.github.com/users/KainosSoftwareLtd","html_url":"https://github.com/KainosSoftwareLtd","followers_url":"https://api.github.com/users/KainosSoftwareLtd/followers","following_url":"https://api.github.com/users/KainosSoftwareLtd/following{/other_user}","gists_url":"https://api.github.com/users/KainosSoftwareLtd/gists{/gist_id}","starred_url":"https://api.github.com/users/KainosSoftwareLtd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KainosSoftwareLtd/subscriptions","organizations_url":"https://api.github.com/users/KainosSoftwareLtd/orgs","repos_url":"https://api.github.com/users/KainosSoftwareLtd/repos","events_url":"https://api.github.com/users/KainosSoftwareLtd/events{/privacy}","received_events_url":"https://api.github.com/users/KainosSoftwareLtd/received_events","type":"Organization","site_admin":false},"repo":{"id":61878724,"name":"aws-api-gateway-demo","full_name":"KainosSoftwareLtd/aws-api-gateway-demo","owner":{"login":"KainosSoftwareLtd","id":1921909,"avatar_url":"https://avatars.githubusercontent.com/u/1921909?v=3","gravatar_id":"","url":"https://api.github.com/users/KainosSoftwareLtd","html_url":"https://github.com/KainosSoftwareLtd","followers_url":"https://api.github.com/users/KainosSoftwareLtd/followers","following_url":"https://api.github.com/users/KainosSoftwareLtd/following{/other_user}","gists_url":"https://api.github.com/users/KainosSoftwareLtd/gists{/gist_id}","starred_url":"https://api.github.com/users/KainosSoftwareLtd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KainosSoftwareLtd/subscriptions","organizations_url":"https://api.github.com/users/KainosSoftwareLtd/orgs","repos_url":"https://api.github.com/users/KainosSoftwareLtd/repos","events_url":"https://api.github.com/users/KainosSoftwareLtd/events{/privacy}","received_events_url":"https://api.github.com/users/KainosSoftwareLtd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo","description":null,"fork":false,"url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo","forks_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/forks","keys_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/teams","hooks_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/hooks","issue_events_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues/events{/number}","events_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/events","assignees_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/assignees{/user}","branches_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/branches{/branch}","tags_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/tags","blobs_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/refs{/sha}","trees_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/statuses/{sha}","languages_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/languages","stargazers_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/stargazers","contributors_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/contributors","subscribers_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/subscribers","subscription_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/subscription","commits_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/commits{/sha}","git_commits_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/git/commits{/sha}","comments_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/comments{/number}","issue_comment_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues/comments{/number}","contents_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/contents/{+path}","compare_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/merges","archive_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/downloads","issues_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues{/number}","pulls_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls{/number}","milestones_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/milestones{/number}","notifications_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/labels{/name}","releases_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/releases{/id}","deployments_url":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/deployments","created_at":"2016-06-24T11:03:45Z","updated_at":"2016-06-24T11:59:37Z","pushed_at":"2016-07-08T07:59:15Z","git_url":"git://github.com/KainosSoftwareLtd/aws-api-gateway-demo.git","ssh_url":"git@github.com:KainosSoftwareLtd/aws-api-gateway-demo.git","clone_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo.git","svn_url":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo","homepage":null,"size":55,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/1"},"html":{"href":"https://github.com/KainosSoftwareLtd/aws-api-gateway-demo/pull/1"},"issue":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues/1"},"comments":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/KainosSoftwareLtd/aws-api-gateway-demo/statuses/cf809ee13865cd1538152c668dc8634d8437b863"}}}}
{"actor":{"display_login":"adrianz-kainos"}}