{"action":"created","comment":{"url":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/comments/137217826","pull_request_review_id":60853044,"id":137217826,"diff_hunk":"@@ -233,13 +237,15 @@ public void processCommandUpdate(JsonObject request, WebSocketSession session) {\n \n         Set<DeviceVO> devices = new HashSet<>();\n         if (deviceId == null) {\n-            devices.addAll(principal.getDeviceIds().stream()\n-                    .map(devId -> deviceService.findByIdWithPermissionsCheck(devId, principal))\n-                    .collect(Collectors.toList()));\n-        } else {\n-            devices.add(deviceService.findByIdWithPermissionsCheck(deviceId, principal));\n+            throw new HiveException(Messages.DEVICE_ID_REQUIRED, SC_BAD_REQUEST);\n+        }\n+\n+        DeviceVO deviceVO = deviceService.findByIdWithPermissionsCheck(deviceId, principal);\n+        if (deviceVO == null) {\n+            throw new HiveException(String.format(Messages.DEVICE_NOT_FOUND, deviceId), SC_NOT_FOUND);\n         }\n \n+        devices.add(deviceVO);\n         if (devices.isEmpty()) {","path":"devicehive-frontend/src/main/java/com/devicehive/websockets/handlers/CommandHandlers.java","position":34,"original_position":34,"commit_id":"7de67a1f933799360baa42480d38001ce92ff83e","original_commit_id":"7de67a1f933799360baa42480d38001ce92ff83e","user":{"login":"yuryoff","id":28753557,"avatar_url":"https://avatars3.githubusercontent.com/u/28753557?v=4","gravatar_id":"","url":"https://api.github.com/users/yuryoff","html_url":"https://github.com/yuryoff","followers_url":"https://api.github.com/users/yuryoff/followers","following_url":"https://api.github.com/users/yuryoff/following{/other_user}","gists_url":"https://api.github.com/users/yuryoff/gists{/gist_id}","starred_url":"https://api.github.com/users/yuryoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuryoff/subscriptions","organizations_url":"https://api.github.com/users/yuryoff/orgs","repos_url":"https://api.github.com/users/yuryoff/repos","events_url":"https://api.github.com/users/yuryoff/events{/privacy}","received_events_url":"https://api.github.com/users/yuryoff/received_events","type":"User","site_admin":false},"body":"It seems at this point devices cannot be empty, so this check can be removed.","created_at":"2017-09-06T09:33:37Z","updated_at":"2017-09-06T09:41:09Z","html_url":"https://github.com/devicehive/devicehive-java-server/pull/351#discussion_r137217826","pull_request_url":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/351","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/comments/137217826"},"html":{"href":"https://github.com/devicehive/devicehive-java-server/pull/351#discussion_r137217826"},"pull_request":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/351"}}},"pull_request":{"url":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/351","id":139334767,"html_url":"https://github.com/devicehive/devicehive-java-server/pull/351","diff_url":"https://github.com/devicehive/devicehive-java-server/pull/351.diff","patch_url":"https://github.com/devicehive/devicehive-java-server/pull/351.patch","issue_url":"https://api.github.com/repos/devicehive/devicehive-java-server/issues/351","number":351,"state":"open","locked":false,"title":"DEV-96, DEV-112, DEV-113 Fix response code mismatches","user":{"login":"AndreyLatysh","id":26743137,"avatar_url":"https://avatars0.githubusercontent.com/u/26743137?v=4","gravatar_id":"","url":"https://api.github.com/users/AndreyLatysh","html_url":"https://github.com/AndreyLatysh","followers_url":"https://api.github.com/users/AndreyLatysh/followers","following_url":"https://api.github.com/users/AndreyLatysh/following{/other_user}","gists_url":"https://api.github.com/users/AndreyLatysh/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreyLatysh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreyLatysh/subscriptions","organizations_url":"https://api.github.com/users/AndreyLatysh/orgs","repos_url":"https://api.github.com/users/AndreyLatysh/repos","events_url":"https://api.github.com/users/AndreyLatysh/events{/privacy}","received_events_url":"https://api.github.com/users/AndreyLatysh/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-09-05T14:15:00Z","updated_at":"2017-09-06T09:41:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae169f6178ff583b93460cf8ea7edce90d0b3e63","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/351/commits","review_comments_url":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/351/comments","review_comment_url":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/devicehive/devicehive-java-server/issues/351/comments","statuses_url":"https://api.github.com/repos/devicehive/devicehive-java-server/statuses/7de67a1f933799360baa42480d38001ce92ff83e","head":{"label":"devicehive:DEV-96","ref":"DEV-96","sha":"7de67a1f933799360baa42480d38001ce92ff83e","user":{"login":"devicehive","id":2528286,"avatar_url":"https://avatars1.githubusercontent.com/u/2528286?v=4","gravatar_id":"","url":"https://api.github.com/users/devicehive","html_url":"https://github.com/devicehive","followers_url":"https://api.github.com/users/devicehive/followers","following_url":"https://api.github.com/users/devicehive/following{/other_user}","gists_url":"https://api.github.com/users/devicehive/gists{/gist_id}","starred_url":"https://api.github.com/users/devicehive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devicehive/subscriptions","organizations_url":"https://api.github.com/users/devicehive/orgs","repos_url":"https://api.github.com/users/devicehive/repos","events_url":"https://api.github.com/users/devicehive/events{/privacy}","received_events_url":"https://api.github.com/users/devicehive/received_events","type":"Organization","site_admin":false},"repo":{"id":10476504,"name":"devicehive-java-server","full_name":"devicehive/devicehive-java-server","owner":{"login":"devicehive","id":2528286,"avatar_url":"https://avatars1.githubusercontent.com/u/2528286?v=4","gravatar_id":"","url":"https://api.github.com/users/devicehive","html_url":"https://github.com/devicehive","followers_url":"https://api.github.com/users/devicehive/followers","following_url":"https://api.github.com/users/devicehive/following{/other_user}","gists_url":"https://api.github.com/users/devicehive/gists{/gist_id}","starred_url":"https://api.github.com/users/devicehive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devicehive/subscriptions","organizations_url":"https://api.github.com/users/devicehive/orgs","repos_url":"https://api.github.com/users/devicehive/repos","events_url":"https://api.github.com/users/devicehive/events{/privacy}","received_events_url":"https://api.github.com/users/devicehive/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/devicehive/devicehive-java-server","description":"DeviceHive Java Server","fork":false,"url":"https://api.github.com/repos/devicehive/devicehive-java-server","forks_url":"https://api.github.com/repos/devicehive/devicehive-java-server/forks","keys_url":"https://api.github.com/repos/devicehive/devicehive-java-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devicehive/devicehive-java-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devicehive/devicehive-java-server/teams","hooks_url":"https://api.github.com/repos/devicehive/devicehive-java-server/hooks","issue_events_url":"https://api.github.com/repos/devicehive/devicehive-java-server/issues/events{/number}","events_url":"https://api.github.com/repos/devicehive/devicehive-java-server/events","assignees_url":"https://api.github.com/repos/devicehive/devicehive-java-server/assignees{/user}","branches_url":"https://api.github.com/repos/devicehive/devicehive-java-server/branches{/branch}","tags_url":"https://api.github.com/repos/devicehive/devicehive-java-server/tags","blobs_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devicehive/devicehive-java-server/statuses/{sha}","languages_url":"https://api.github.com/repos/devicehive/devicehive-java-server/languages","stargazers_url":"https://api.github.com/repos/devicehive/devicehive-java-server/stargazers","contributors_url":"https://api.github.com/repos/devicehive/devicehive-java-server/contributors","subscribers_url":"https://api.github.com/repos/devicehive/devicehive-java-server/subscribers","subscription_url":"https://api.github.com/repos/devicehive/devicehive-java-server/subscription","commits_url":"https://api.github.com/repos/devicehive/devicehive-java-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/devicehive/devicehive-java-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/devicehive/devicehive-java-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/devicehive/devicehive-java-server/contents/{+path}","compare_url":"https://api.github.com/repos/devicehive/devicehive-java-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devicehive/devicehive-java-server/merges","archive_url":"https://api.github.com/repos/devicehive/devicehive-java-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devicehive/devicehive-java-server/downloads","issues_url":"https://api.github.com/repos/devicehive/devicehive-java-server/issues{/number}","pulls_url":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls{/number}","milestones_url":"https://api.github.com/repos/devicehive/devicehive-java-server/milestones{/number}","notifications_url":"https://api.github.com/repos/devicehive/devicehive-java-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devicehive/devicehive-java-server/labels{/name}","releases_url":"https://api.github.com/repos/devicehive/devicehive-java-server/releases{/id}","deployments_url":"https://api.github.com/repos/devicehive/devicehive-java-server/deployments","created_at":"2013-06-04T10:47:59Z","updated_at":"2017-09-02T11:10:59Z","pushed_at":"2017-09-06T07:45:36Z","git_url":"git://github.com/devicehive/devicehive-java-server.git","ssh_url":"git@github.com:devicehive/devicehive-java-server.git","clone_url":"https://github.com/devicehive/devicehive-java-server.git","svn_url":"https://github.com/devicehive/devicehive-java-server","homepage":"http://www.devicehive.com","size":8662,"stargazers_count":63,"watchers_count":63,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":43,"mirror_url":null,"open_issues_count":35,"forks":43,"open_issues":35,"watchers":63,"default_branch":"master"}},"base":{"label":"devicehive:development","ref":"development","sha":"3f37bebed2264d4b1fac416b25467c8a65e7ea2f","user":{"login":"devicehive","id":2528286,"avatar_url":"https://avatars1.githubusercontent.com/u/2528286?v=4","gravatar_id":"","url":"https://api.github.com/users/devicehive","html_url":"https://github.com/devicehive","followers_url":"https://api.github.com/users/devicehive/followers","following_url":"https://api.github.com/users/devicehive/following{/other_user}","gists_url":"https://api.github.com/users/devicehive/gists{/gist_id}","starred_url":"https://api.github.com/users/devicehive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devicehive/subscriptions","organizations_url":"https://api.github.com/users/devicehive/orgs","repos_url":"https://api.github.com/users/devicehive/repos","events_url":"https://api.github.com/users/devicehive/events{/privacy}","received_events_url":"https://api.github.com/users/devicehive/received_events","type":"Organization","site_admin":false},"repo":{"id":10476504,"name":"devicehive-java-server","full_name":"devicehive/devicehive-java-server","owner":{"login":"devicehive","id":2528286,"avatar_url":"https://avatars1.githubusercontent.com/u/2528286?v=4","gravatar_id":"","url":"https://api.github.com/users/devicehive","html_url":"https://github.com/devicehive","followers_url":"https://api.github.com/users/devicehive/followers","following_url":"https://api.github.com/users/devicehive/following{/other_user}","gists_url":"https://api.github.com/users/devicehive/gists{/gist_id}","starred_url":"https://api.github.com/users/devicehive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devicehive/subscriptions","organizations_url":"https://api.github.com/users/devicehive/orgs","repos_url":"https://api.github.com/users/devicehive/repos","events_url":"https://api.github.com/users/devicehive/events{/privacy}","received_events_url":"https://api.github.com/users/devicehive/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/devicehive/devicehive-java-server","description":"DeviceHive Java Server","fork":false,"url":"https://api.github.com/repos/devicehive/devicehive-java-server","forks_url":"https://api.github.com/repos/devicehive/devicehive-java-server/forks","keys_url":"https://api.github.com/repos/devicehive/devicehive-java-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devicehive/devicehive-java-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devicehive/devicehive-java-server/teams","hooks_url":"https://api.github.com/repos/devicehive/devicehive-java-server/hooks","issue_events_url":"https://api.github.com/repos/devicehive/devicehive-java-server/issues/events{/number}","events_url":"https://api.github.com/repos/devicehive/devicehive-java-server/events","assignees_url":"https://api.github.com/repos/devicehive/devicehive-java-server/assignees{/user}","branches_url":"https://api.github.com/repos/devicehive/devicehive-java-server/branches{/branch}","tags_url":"https://api.github.com/repos/devicehive/devicehive-java-server/tags","blobs_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devicehive/devicehive-java-server/statuses/{sha}","languages_url":"https://api.github.com/repos/devicehive/devicehive-java-server/languages","stargazers_url":"https://api.github.com/repos/devicehive/devicehive-java-server/stargazers","contributors_url":"https://api.github.com/repos/devicehive/devicehive-java-server/contributors","subscribers_url":"https://api.github.com/repos/devicehive/devicehive-java-server/subscribers","subscription_url":"https://api.github.com/repos/devicehive/devicehive-java-server/subscription","commits_url":"https://api.github.com/repos/devicehive/devicehive-java-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/devicehive/devicehive-java-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/devicehive/devicehive-java-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/devicehive/devicehive-java-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/devicehive/devicehive-java-server/contents/{+path}","compare_url":"https://api.github.com/repos/devicehive/devicehive-java-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devicehive/devicehive-java-server/merges","archive_url":"https://api.github.com/repos/devicehive/devicehive-java-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devicehive/devicehive-java-server/downloads","issues_url":"https://api.github.com/repos/devicehive/devicehive-java-server/issues{/number}","pulls_url":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls{/number}","milestones_url":"https://api.github.com/repos/devicehive/devicehive-java-server/milestones{/number}","notifications_url":"https://api.github.com/repos/devicehive/devicehive-java-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devicehive/devicehive-java-server/labels{/name}","releases_url":"https://api.github.com/repos/devicehive/devicehive-java-server/releases{/id}","deployments_url":"https://api.github.com/repos/devicehive/devicehive-java-server/deployments","created_at":"2013-06-04T10:47:59Z","updated_at":"2017-09-02T11:10:59Z","pushed_at":"2017-09-06T07:45:36Z","git_url":"git://github.com/devicehive/devicehive-java-server.git","ssh_url":"git@github.com:devicehive/devicehive-java-server.git","clone_url":"https://github.com/devicehive/devicehive-java-server.git","svn_url":"https://github.com/devicehive/devicehive-java-server","homepage":"http://www.devicehive.com","size":8662,"stargazers_count":63,"watchers_count":63,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":43,"mirror_url":null,"open_issues_count":35,"forks":43,"open_issues":35,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/351"},"html":{"href":"https://github.com/devicehive/devicehive-java-server/pull/351"},"issue":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/issues/351"},"comments":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/issues/351/comments"},"review_comments":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/351/comments"},"review_comment":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/pulls/351/commits"},"statuses":{"href":"https://api.github.com/repos/devicehive/devicehive-java-server/statuses/7de67a1f933799360baa42480d38001ce92ff83e"}},"author_association":"NONE"}}
{"actor":{"display_login":"yuryoff"}}