payload: {"action":"created","comment":{"url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/comments/331795955","pull_request_review_id":297845492,"id":331795955,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMzMTc5NTk1NQ==","diff_hunk":"@@ -0,0 +1,83 @@\n+package ru.mail.polis.service.shkalev;\n+\n+import java.io.IOException;\n+import java.nio.ByteBuffer;\n+import java.util.NoSuchElementException;\n+\n+import org.jetbrains.annotations.NotNull;\n+\n+import com.google.common.base.Charsets;\n+\n+import one.nio.http.HttpServer;\n+import one.nio.http.HttpServerConfig;\n+import one.nio.http.HttpSession;\n+import one.nio.http.Param;\n+import one.nio.http.Path;\n+import one.nio.http.Request;\n+import one.nio.http.Response;\n+import one.nio.server.AcceptorConfig;\n+import ru.mail.polis.dao.DAO;\n+import ru.mail.polis.service.Service;\n+\n+public class MySuperService extends HttpServer implements Service {\n+\n+    private final DAO dao;\n+\n+    public MySuperService(final int port, @NotNull final DAO dao) throws IOException {\n+        super(getConfig(port));\n+        this.dao = dao;\n+    }\n+\n+    private static HttpServerConfig getConfig(final int port) {\n+        if (port <= 1024 || port >= 65535) {\n+            throw new IllegalArgumentException();\n+        }\n+        AcceptorConfig acceptor = new AcceptorConfig();\n+        acceptor.port = port;\n+        HttpServerConfig config = new HttpServerConfig();\n+        config.acceptors = new AcceptorConfig[]{acceptor};\n+        return config;\n+    }\n+\n+    @Path(\"/v0/entity\")\n+    public Response entity(@NotNull final Request request,\n+                           @Param(\"id\") final String id) {\n+        if (id == null || id.isEmpty()) {\n+            return new Response(Response.BAD_REQUEST, Response.EMPTY);\n+        }\n+        ByteBuffer key = ByteBuffer.wrap(id.getBytes(Charsets.UTF_8));\n+        try {\n+            switch (request.getMethod()) {\n+                case Request.METHOD_GET:\n+                    ByteBuffer value = dao.get(key);\n+                    ByteBuffer duplicate = value.duplicate();\n+                    byte[] body = new byte[duplicate.remaining()];\n+                    duplicate.get(body);\n+                    return new Response(Response.OK, body);\n+                case Request.METHOD_PUT:\n+                    dao.upsert(key, ByteBuffer.wrap(request.getBody()));\n+                    return new Response(Response.CREATED, Response.EMPTY);\n+                case Request.METHOD_DELETE:\n+                    dao.remove(key);\n+                    return new Response(Response.ACCEPTED, Response.EMPTY);\n+                default:\n+                    return new Response(Response.METHOD_NOT_ALLOWED, Response.EMPTY);","path":"src/main/java/ru/mail/polis/service/shkalev/MySuperService.java","position":64,"original_position":64,"commit_id":"6ab635b3430c60169f96ba7393ef03cdafb61e38","original_commit_id":"6ab635b3430c60169f96ba7393ef03cdafb61e38","user":{"login":"codeclimate[bot]","id":36754821,"node_id":"MDM6Qm90MzY3NTQ4MjE=","avatar_url":"https://avatars0.githubusercontent.com/in/9403?v=4","gravatar_id":"","url":"https://api.github.com/users/codeclimate%5Bbot%5D","html_url":"https://github.com/apps/codeclimate","followers_url":"https://api.github.com/users/codeclimate%5Bbot%5D/followers","following_url":"https://api.github.com/users/codeclimate%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/codeclimate%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/codeclimate%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeclimate%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/codeclimate%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/codeclimate%5Bbot%5D/repos","events_url":"https://api.github.com/users/codeclimate%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/codeclimate%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"Avoid too many `return` statements within this method.","created_at":"2019-10-06T15:41:38Z","updated_at":"2019-10-06T15:41:38Z","html_url":"https://github.com/polis-mail-ru/2019-highload-dht/pull/12#discussion_r331795955","pull_request_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/12","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/comments/331795955"},"html":{"href":"https://github.com/polis-mail-ru/2019-highload-dht/pull/12#discussion_r331795955"},"pull_request":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/12","id":324834994,"node_id":"MDExOlB1bGxSZXF1ZXN0MzI0ODM0OTk0","html_url":"https://github.com/polis-mail-ru/2019-highload-dht/pull/12","diff_url":"https://github.com/polis-mail-ru/2019-highload-dht/pull/12.diff","patch_url":"https://github.com/polis-mail-ru/2019-highload-dht/pull/12.patch","issue_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/issues/12","number":12,"state":"open","locked":false,"title":"implementation DAO, implementation Service","user":{"login":"EugSh","id":41777711,"node_id":"MDQ6VXNlcjQxNzc3NzEx","avatar_url":"https://avatars1.githubusercontent.com/u/41777711?v=4","gravatar_id":"","url":"https://api.github.com/users/EugSh","html_url":"https://github.com/EugSh","followers_url":"https://api.github.com/users/EugSh/followers","following_url":"https://api.github.com/users/EugSh/following{/other_user}","gists_url":"https://api.github.com/users/EugSh/gists{/gist_id}","starred_url":"https://api.github.com/users/EugSh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EugSh/subscriptions","organizations_url":"https://api.github.com/users/EugSh/orgs","repos_url":"https://api.github.com/users/EugSh/repos","events_url":"https://api.github.com/users/EugSh/events{/privacy}","received_events_url":"https://api.github.com/users/EugSh/received_events","type":"User","site_admin":false},"body":"DAO взял с прошлого года и ничего не менял\r\n.","created_at":"2019-10-04T20:18:47Z","updated_at":"2019-10-06T15:41:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac9b4efbfee68c245925fff1dcaf6a4a0f7460e8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/12/commits","review_comments_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/12/comments","review_comment_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/comments{/number}","comments_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/issues/12/comments","statuses_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/statuses/6ab635b3430c60169f96ba7393ef03cdafb61e38","head":{"label":"EugSh:master","ref":"master","sha":"6ab635b3430c60169f96ba7393ef03cdafb61e38","user":{"login":"EugSh","id":41777711,"node_id":"MDQ6VXNlcjQxNzc3NzEx","avatar_url":"https://avatars1.githubusercontent.com/u/41777711?v=4","gravatar_id":"","url":"https://api.github.com/users/EugSh","html_url":"https://github.com/EugSh","followers_url":"https://api.github.com/users/EugSh/followers","following_url":"https://api.github.com/users/EugSh/following{/other_user}","gists_url":"https://api.github.com/users/EugSh/gists{/gist_id}","starred_url":"https://api.github.com/users/EugSh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EugSh/subscriptions","organizations_url":"https://api.github.com/users/EugSh/orgs","repos_url":"https://api.github.com/users/EugSh/repos","events_url":"https://api.github.com/users/EugSh/events{/privacy}","received_events_url":"https://api.github.com/users/EugSh/received_events","type":"User","site_admin":false},"repo":{"id":211530001,"node_id":"MDEwOlJlcG9zaXRvcnkyMTE1MzAwMDE=","name":"2019-highload-dht","full_name":"EugSh/2019-highload-dht","private":false,"owner":{"login":"EugSh","id":41777711,"node_id":"MDQ6VXNlcjQxNzc3NzEx","avatar_url":"https://avatars1.githubusercontent.com/u/41777711?v=4","gravatar_id":"","url":"https://api.github.com/users/EugSh","html_url":"https://github.com/EugSh","followers_url":"https://api.github.com/users/EugSh/followers","following_url":"https://api.github.com/users/EugSh/following{/other_user}","gists_url":"https://api.github.com/users/EugSh/gists{/gist_id}","starred_url":"https://api.github.com/users/EugSh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EugSh/subscriptions","organizations_url":"https://api.github.com/users/EugSh/orgs","repos_url":"https://api.github.com/users/EugSh/repos","events_url":"https://api.github.com/users/EugSh/events{/privacy}","received_events_url":"https://api.github.com/users/EugSh/received_events","type":"User","site_admin":false},"html_url":"https://github.com/EugSh/2019-highload-dht","description":"Курсовой проект 2019 года курса \"Highload системы\"","fork":true,"url":"https://api.github.com/repos/EugSh/2019-highload-dht","forks_url":"https://api.github.com/repos/EugSh/2019-highload-dht/forks","keys_url":"https://api.github.com/repos/EugSh/2019-highload-dht/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EugSh/2019-highload-dht/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EugSh/2019-highload-dht/teams","hooks_url":"https://api.github.com/repos/EugSh/2019-highload-dht/hooks","issue_events_url":"https://api.github.com/repos/EugSh/2019-highload-dht/issues/events{/number}","events_url":"https://api.github.com/repos/EugSh/2019-highload-dht/events","assignees_url":"https://api.github.com/repos/EugSh/2019-highload-dht/assignees{/user}","branches_url":"https://api.github.com/repos/EugSh/2019-highload-dht/branches{/branch}","tags_url":"https://api.github.com/repos/EugSh/2019-highload-dht/tags","blobs_url":"https://api.github.com/repos/EugSh/2019-highload-dht/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EugSh/2019-highload-dht/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EugSh/2019-highload-dht/git/refs{/sha}","trees_url":"https://api.github.com/repos/EugSh/2019-highload-dht/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EugSh/2019-highload-dht/statuses/{sha}","languages_url":"https://api.github.com/repos/EugSh/2019-highload-dht/languages","stargazers_url":"https://api.github.com/repos/EugSh/2019-highload-dht/stargazers","contributors_url":"https://api.github.com/repos/EugSh/2019-highload-dht/contributors","subscribers_url":"https://api.github.com/repos/EugSh/2019-highload-dht/subscribers","subscription_url":"https://api.github.com/repos/EugSh/2019-highload-dht/subscription","commits_url":"https://api.github.com/repos/EugSh/2019-highload-dht/commits{/sha}","git_commits_url":"https://api.github.com/repos/EugSh/2019-highload-dht/git/commits{/sha}","comments_url":"https://api.github.com/repos/EugSh/2019-highload-dht/comments{/number}","issue_comment_url":"https://api.github.com/repos/EugSh/2019-highload-dht/issues/comments{/number}","contents_url":"https://api.github.com/repos/EugSh/2019-highload-dht/contents/{+path}","compare_url":"https://api.github.com/repos/EugSh/2019-highload-dht/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EugSh/2019-highload-dht/merges","archive_url":"https://api.github.com/repos/EugSh/2019-highload-dht/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EugSh/2019-highload-dht/downloads","issues_url":"https://api.github.com/repos/EugSh/2019-highload-dht/issues{/number}","pulls_url":"https://api.github.com/repos/EugSh/2019-highload-dht/pulls{/number}","milestones_url":"https://api.github.com/repos/EugSh/2019-highload-dht/milestones{/number}","notifications_url":"https://api.github.com/repos/EugSh/2019-highload-dht/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EugSh/2019-highload-dht/labels{/name}","releases_url":"https://api.github.com/repos/EugSh/2019-highload-dht/releases{/id}","deployments_url":"https://api.github.com/repos/EugSh/2019-highload-dht/deployments","created_at":"2019-09-28T16:32:48Z","updated_at":"2019-10-06T15:41:16Z","pushed_at":"2019-10-06T15:41:14Z","git_url":"git://github.com/EugSh/2019-highload-dht.git","ssh_url":"git@github.com:EugSh/2019-highload-dht.git","clone_url":"https://github.com/EugSh/2019-highload-dht.git","svn_url":"https://github.com/EugSh/2019-highload-dht","homepage":"","size":89,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"polis-mail-ru:master","ref":"master","sha":"d6357dccc16c7d5c001fd2a2203298c36fe96b63","user":{"login":"polis-mail-ru","id":31819365,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxODE5MzY1","avatar_url":"https://avatars0.githubusercontent.com/u/31819365?v=4","gravatar_id":"","url":"https://api.github.com/users/polis-mail-ru","html_url":"https://github.com/polis-mail-ru","followers_url":"https://api.github.com/users/polis-mail-ru/followers","following_url":"https://api.github.com/users/polis-mail-ru/following{/other_user}","gists_url":"https://api.github.com/users/polis-mail-ru/gists{/gist_id}","starred_url":"https://api.github.com/users/polis-mail-ru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polis-mail-ru/subscriptions","organizations_url":"https://api.github.com/users/polis-mail-ru/orgs","repos_url":"https://api.github.com/users/polis-mail-ru/repos","events_url":"https://api.github.com/users/polis-mail-ru/events{/privacy}","received_events_url":"https://api.github.com/users/polis-mail-ru/received_events","type":"Organization","site_admin":false},"repo":{"id":211175384,"node_id":"MDEwOlJlcG9zaXRvcnkyMTExNzUzODQ=","name":"2019-highload-dht","full_name":"polis-mail-ru/2019-highload-dht","private":false,"owner":{"login":"polis-mail-ru","id":31819365,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxODE5MzY1","avatar_url":"https://avatars0.githubusercontent.com/u/31819365?v=4","gravatar_id":"","url":"https://api.github.com/users/polis-mail-ru","html_url":"https://github.com/polis-mail-ru","followers_url":"https://api.github.com/users/polis-mail-ru/followers","following_url":"https://api.github.com/users/polis-mail-ru/following{/other_user}","gists_url":"https://api.github.com/users/polis-mail-ru/gists{/gist_id}","starred_url":"https://api.github.com/users/polis-mail-ru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polis-mail-ru/subscriptions","organizations_url":"https://api.github.com/users/polis-mail-ru/orgs","repos_url":"https://api.github.com/users/polis-mail-ru/repos","events_url":"https://api.github.com/users/polis-mail-ru/events{/privacy}","received_events_url":"https://api.github.com/users/polis-mail-ru/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/polis-mail-ru/2019-highload-dht","description":"Курсовой проект 2019 года курса \"Highload системы\"","fork":false,"url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht","forks_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/forks","keys_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/keys{/key_id}","collaborators_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/teams","hooks_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/hooks","issue_events_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/issues/events{/number}","events_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/events","assignees_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/assignees{/user}","branches_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/branches{/branch}","tags_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/tags","blobs_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/git/refs{/sha}","trees_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/git/trees{/sha}","statuses_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/statuses/{sha}","languages_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/languages","stargazers_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/stargazers","contributors_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/contributors","subscribers_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/subscribers","subscription_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/subscription","commits_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/commits{/sha}","git_commits_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/git/commits{/sha}","comments_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/comments{/number}","issue_comment_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/issues/comments{/number}","contents_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/contents/{+path}","compare_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/compare/{base}...{head}","merges_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/merges","archive_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/downloads","issues_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/issues{/number}","pulls_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls{/number}","milestones_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/milestones{/number}","notifications_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/labels{/name}","releases_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/releases{/id}","deployments_url":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/deployments","created_at":"2019-09-26T20:25:09Z","updated_at":"2019-10-06T15:28:04Z","pushed_at":"2019-10-06T15:41:16Z","git_url":"git://github.com/polis-mail-ru/2019-highload-dht.git","ssh_url":"git@github.com:polis-mail-ru/2019-highload-dht.git","clone_url":"https://github.com/polis-mail-ru/2019-highload-dht.git","svn_url":"https://github.com/polis-mail-ru/2019-highload-dht","homepage":"","size":33,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":15,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":32,"open_issues":15,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/12"},"html":{"href":"https://github.com/polis-mail-ru/2019-highload-dht/pull/12"},"issue":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/issues/12"},"comments":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/polis-mail-ru/2019-highload-dht/statuses/6ab635b3430c60169f96ba7393ef03cdafb61e38"}},"author_association":"NONE"}}
other: {"actor":{"display_login":"codeclimate"}}