{"action":"created","comment":{"url":"https://api.github.com/repos/yegor256/netbout/pulls/comments/57524112","id":57524112,"diff_hunk":"@@ -202,7 +203,11 @@ public long unread() throws IOException {\n             )\n             .where(DyFriends.HASH, Conditions.equalTo(this.bout))\n             .where(DyFriends.RANGE, Conditions.equalTo(this.self))\n-            .iterator().next();\n+            .iterator();\n+        if (!iterator.hasNext()) {\n+            throw new Inbox.BoutNotFoundException(this.bout);","path":"netbout-web/src/main/java/com/netbout/dynamo/DyMessages.java","position":24,"original_position":24,"commit_id":"d319f2a7a72538b6c3e7b49821fb0264c0f1a9fb","original_commit_id":"d319f2a7a72538b6c3e7b49821fb0264c0f1a9fb","user":{"login":"2686747","id":8187855,"avatar_url":"https://avatars.githubusercontent.com/u/8187855?v=3","gravatar_id":"","url":"https://api.github.com/users/2686747","html_url":"https://github.com/2686747","followers_url":"https://api.github.com/users/2686747/followers","following_url":"https://api.github.com/users/2686747/following{/other_user}","gists_url":"https://api.github.com/users/2686747/gists{/gist_id}","starred_url":"https://api.github.com/users/2686747/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2686747/subscriptions","organizations_url":"https://api.github.com/users/2686747/orgs","repos_url":"https://api.github.com/users/2686747/repos","events_url":"https://api.github.com/users/2686747/events{/privacy}","received_events_url":"https://api.github.com/users/2686747/received_events","type":"User","site_admin":false},"body":"@original-brownbear i agree about wrapping of whole set of directives, but i don't like `HttpException` in `DyMessages`(i don't like and `Inbox.BoutNotFoundException` actually, i would prefer separated `BoutNofFoundException`). `DyMessages` doesn't know about our Http environment, we mix our http business to database layer. ","created_at":"2016-03-27T06:21:30Z","updated_at":"2016-03-27T06:21:30Z","html_url":"https://github.com/yegor256/netbout/pull/1094#discussion_r57524112","pull_request_url":"https://api.github.com/repos/yegor256/netbout/pulls/1094","_links":{"self":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/comments/57524112"},"html":{"href":"https://github.com/yegor256/netbout/pull/1094#discussion_r57524112"},"pull_request":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/1094"}}},"pull_request":{"url":"https://api.github.com/repos/yegor256/netbout/pulls/1094","id":64095397,"html_url":"https://github.com/yegor256/netbout/pull/1094","diff_url":"https://github.com/yegor256/netbout/pull/1094.diff","patch_url":"https://github.com/yegor256/netbout/pull/1094.patch","issue_url":"https://api.github.com/repos/yegor256/netbout/issues/1094","number":1094,"state":"open","locked":false,"title":"#834: NoSuchElementException: no more items in the frame, position=-1 strikes back","user":{"login":"2686747","id":8187855,"avatar_url":"https://avatars.githubusercontent.com/u/8187855?v=3","gravatar_id":"","url":"https://api.github.com/users/2686747","html_url":"https://github.com/2686747","followers_url":"https://api.github.com/users/2686747/followers","following_url":"https://api.github.com/users/2686747/following{/other_user}","gists_url":"https://api.github.com/users/2686747/gists{/gist_id}","starred_url":"https://api.github.com/users/2686747/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2686747/subscriptions","organizations_url":"https://api.github.com/users/2686747/orgs","repos_url":"https://api.github.com/users/2686747/repos","events_url":"https://api.github.com/users/2686747/events{/privacy}","received_events_url":"https://api.github.com/users/2686747/received_events","type":"User","site_admin":false},"body":"#834: added catching unexpected exceptions.\r\nProblem occurs when user was kicked from bout. It seems like there is  a problem with caching. Normally logic in `TkIndex.act() ` will check user in current bout and throw `RsFailure` or `HttpException`. These exceptions will be processed and user will be redirected to home page with error message. With current cache settings when 5 minutes pass this logic still process user as bout's participant but later in code (`DyMessages.unread()` exactly) application try fetch data for current user from database and doesn't find it (because user was kicked >5min ago). Unchecked iteration throws `NoSuchElementException extends RuntimeException` and user see stacktrace. Solution:   if `DyMessages.unread()` processes kicked user throw `Inbox.BoutNotFoundException`,  catch it later in appropriate place (`TkIndex`) and redirect user to home page with exception `RsFailure` and \"_page not found_\" message.","created_at":"2016-03-24T20:40:34Z","updated_at":"2016-03-27T06:21:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"952c7cc65a4ea4b7d67226efc7b82ec3ceae3cba","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yegor256/netbout/pulls/1094/commits","review_comments_url":"https://api.github.com/repos/yegor256/netbout/pulls/1094/comments","review_comment_url":"https://api.github.com/repos/yegor256/netbout/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yegor256/netbout/issues/1094/comments","statuses_url":"https://api.github.com/repos/yegor256/netbout/statuses/d319f2a7a72538b6c3e7b49821fb0264c0f1a9fb","head":{"label":"2686747:834","ref":"834","sha":"d319f2a7a72538b6c3e7b49821fb0264c0f1a9fb","user":{"login":"2686747","id":8187855,"avatar_url":"https://avatars.githubusercontent.com/u/8187855?v=3","gravatar_id":"","url":"https://api.github.com/users/2686747","html_url":"https://github.com/2686747","followers_url":"https://api.github.com/users/2686747/followers","following_url":"https://api.github.com/users/2686747/following{/other_user}","gists_url":"https://api.github.com/users/2686747/gists{/gist_id}","starred_url":"https://api.github.com/users/2686747/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2686747/subscriptions","organizations_url":"https://api.github.com/users/2686747/orgs","repos_url":"https://api.github.com/users/2686747/repos","events_url":"https://api.github.com/users/2686747/events{/privacy}","received_events_url":"https://api.github.com/users/2686747/received_events","type":"User","site_admin":false},"repo":{"id":51551281,"name":"netbout","full_name":"2686747/netbout","owner":{"login":"2686747","id":8187855,"avatar_url":"https://avatars.githubusercontent.com/u/8187855?v=3","gravatar_id":"","url":"https://api.github.com/users/2686747","html_url":"https://github.com/2686747","followers_url":"https://api.github.com/users/2686747/followers","following_url":"https://api.github.com/users/2686747/following{/other_user}","gists_url":"https://api.github.com/users/2686747/gists{/gist_id}","starred_url":"https://api.github.com/users/2686747/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2686747/subscriptions","organizations_url":"https://api.github.com/users/2686747/orgs","repos_url":"https://api.github.com/users/2686747/repos","events_url":"https://api.github.com/users/2686747/events{/privacy}","received_events_url":"https://api.github.com/users/2686747/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/2686747/netbout","description":"Private talks made easy","fork":true,"url":"https://api.github.com/repos/2686747/netbout","forks_url":"https://api.github.com/repos/2686747/netbout/forks","keys_url":"https://api.github.com/repos/2686747/netbout/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2686747/netbout/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2686747/netbout/teams","hooks_url":"https://api.github.com/repos/2686747/netbout/hooks","issue_events_url":"https://api.github.com/repos/2686747/netbout/issues/events{/number}","events_url":"https://api.github.com/repos/2686747/netbout/events","assignees_url":"https://api.github.com/repos/2686747/netbout/assignees{/user}","branches_url":"https://api.github.com/repos/2686747/netbout/branches{/branch}","tags_url":"https://api.github.com/repos/2686747/netbout/tags","blobs_url":"https://api.github.com/repos/2686747/netbout/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2686747/netbout/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2686747/netbout/git/refs{/sha}","trees_url":"https://api.github.com/repos/2686747/netbout/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2686747/netbout/statuses/{sha}","languages_url":"https://api.github.com/repos/2686747/netbout/languages","stargazers_url":"https://api.github.com/repos/2686747/netbout/stargazers","contributors_url":"https://api.github.com/repos/2686747/netbout/contributors","subscribers_url":"https://api.github.com/repos/2686747/netbout/subscribers","subscription_url":"https://api.github.com/repos/2686747/netbout/subscription","commits_url":"https://api.github.com/repos/2686747/netbout/commits{/sha}","git_commits_url":"https://api.github.com/repos/2686747/netbout/git/commits{/sha}","comments_url":"https://api.github.com/repos/2686747/netbout/comments{/number}","issue_comment_url":"https://api.github.com/repos/2686747/netbout/issues/comments{/number}","contents_url":"https://api.github.com/repos/2686747/netbout/contents/{+path}","compare_url":"https://api.github.com/repos/2686747/netbout/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2686747/netbout/merges","archive_url":"https://api.github.com/repos/2686747/netbout/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2686747/netbout/downloads","issues_url":"https://api.github.com/repos/2686747/netbout/issues{/number}","pulls_url":"https://api.github.com/repos/2686747/netbout/pulls{/number}","milestones_url":"https://api.github.com/repos/2686747/netbout/milestones{/number}","notifications_url":"https://api.github.com/repos/2686747/netbout/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2686747/netbout/labels{/name}","releases_url":"https://api.github.com/repos/2686747/netbout/releases{/id}","deployments_url":"https://api.github.com/repos/2686747/netbout/deployments","created_at":"2016-02-11T22:18:06Z","updated_at":"2016-02-11T22:18:07Z","pushed_at":"2016-03-26T20:38:17Z","git_url":"git://github.com/2686747/netbout.git","ssh_url":"git@github.com:2686747/netbout.git","clone_url":"https://github.com/2686747/netbout.git","svn_url":"https://github.com/2686747/netbout","homepage":"www.netbout.com","size":18059,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yegor256:master","ref":"master","sha":"bf698ec3b72d5066c4c45c089f505292d80ebf0f","user":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"repo":{"id":9580819,"name":"netbout","full_name":"yegor256/netbout","owner":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yegor256/netbout","description":"Private talks made easy","fork":false,"url":"https://api.github.com/repos/yegor256/netbout","forks_url":"https://api.github.com/repos/yegor256/netbout/forks","keys_url":"https://api.github.com/repos/yegor256/netbout/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yegor256/netbout/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yegor256/netbout/teams","hooks_url":"https://api.github.com/repos/yegor256/netbout/hooks","issue_events_url":"https://api.github.com/repos/yegor256/netbout/issues/events{/number}","events_url":"https://api.github.com/repos/yegor256/netbout/events","assignees_url":"https://api.github.com/repos/yegor256/netbout/assignees{/user}","branches_url":"https://api.github.com/repos/yegor256/netbout/branches{/branch}","tags_url":"https://api.github.com/repos/yegor256/netbout/tags","blobs_url":"https://api.github.com/repos/yegor256/netbout/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yegor256/netbout/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yegor256/netbout/git/refs{/sha}","trees_url":"https://api.github.com/repos/yegor256/netbout/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yegor256/netbout/statuses/{sha}","languages_url":"https://api.github.com/repos/yegor256/netbout/languages","stargazers_url":"https://api.github.com/repos/yegor256/netbout/stargazers","contributors_url":"https://api.github.com/repos/yegor256/netbout/contributors","subscribers_url":"https://api.github.com/repos/yegor256/netbout/subscribers","subscription_url":"https://api.github.com/repos/yegor256/netbout/subscription","commits_url":"https://api.github.com/repos/yegor256/netbout/commits{/sha}","git_commits_url":"https://api.github.com/repos/yegor256/netbout/git/commits{/sha}","comments_url":"https://api.github.com/repos/yegor256/netbout/comments{/number}","issue_comment_url":"https://api.github.com/repos/yegor256/netbout/issues/comments{/number}","contents_url":"https://api.github.com/repos/yegor256/netbout/contents/{+path}","compare_url":"https://api.github.com/repos/yegor256/netbout/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yegor256/netbout/merges","archive_url":"https://api.github.com/repos/yegor256/netbout/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yegor256/netbout/downloads","issues_url":"https://api.github.com/repos/yegor256/netbout/issues{/number}","pulls_url":"https://api.github.com/repos/yegor256/netbout/pulls{/number}","milestones_url":"https://api.github.com/repos/yegor256/netbout/milestones{/number}","notifications_url":"https://api.github.com/repos/yegor256/netbout/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yegor256/netbout/labels{/name}","releases_url":"https://api.github.com/repos/yegor256/netbout/releases{/id}","deployments_url":"https://api.github.com/repos/yegor256/netbout/deployments","created_at":"2013-04-21T14:49:21Z","updated_at":"2016-02-28T14:14:11Z","pushed_at":"2016-03-26T20:38:18Z","git_url":"git://github.com/yegor256/netbout.git","ssh_url":"git@github.com:yegor256/netbout.git","clone_url":"https://github.com/yegor256/netbout.git","svn_url":"https://github.com/yegor256/netbout","homepage":"www.netbout.com","size":18420,"stargazers_count":28,"watchers_count":28,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":36,"mirror_url":null,"open_issues_count":99,"forks":36,"open_issues":99,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/1094"},"html":{"href":"https://github.com/yegor256/netbout/pull/1094"},"issue":{"href":"https://api.github.com/repos/yegor256/netbout/issues/1094"},"comments":{"href":"https://api.github.com/repos/yegor256/netbout/issues/1094/comments"},"review_comments":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/1094/comments"},"review_comment":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yegor256/netbout/pulls/1094/commits"},"statuses":{"href":"https://api.github.com/repos/yegor256/netbout/statuses/d319f2a7a72538b6c3e7b49821fb0264c0f1a9fb"}}}}