{"action":"created","comment":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/27717883","id":27717883,"diff_hunk":"@@ -0,0 +1,63 @@\n+package com.hazelcast.client.impl.protocol.util;\n+\n+import com.hazelcast.client.impl.protocol.ClientMessage;\n+\n+import java.nio.ByteBuffer;\n+\n+/**\n+ * ClientMessage builder from incoming bytebuffer parts\n+ */\n+public class ClientMessageAccumulator\n+        extends ClientMessage {\n+\n+    public int accumulate(ByteBuffer byteBuffer) {\n+        int total = 0;\n+        if (index() == 0) {\n+            total += initFrameSize(byteBuffer);\n+        }\n+        while (index() >= BitUtil.SIZE_OF_INT && byteBuffer.hasRemaining() && !isComplete()) {\n+            total += accumulate(byteBuffer, remainingSize());\n+        }\n+        return total;\n+    }\n+\n+    private int initFrameSize(ByteBuffer byteBuffer) {\n+        if (byteBuffer.remaining() < BitUtil.SIZE_OF_INT) {\n+            return 0;\n+        }\n+        final int accumulatedBytesSize = accumulate(byteBuffer, BitUtil.SIZE_OF_INT);\n+        return accumulatedBytesSize;\n+    }\n+\n+    private int accumulate(ByteBuffer byteBuffer, int length) {\n+        final int remaining = byteBuffer.remaining();\n+        final int readLength = remaining < length ? remaining : length;\n+        if (readLength > 0) {\n+            final int requiredCapacity = index() + readLength;\n+            ensureCapacity(requiredCapacity);\n+            buffer.putBytes(index(), byteBuffer, readLength);\n+            index(index() + readLength);\n+            return readLength;\n+        }\n+        return 0;\n+    }\n+\n+    public boolean isComplete() {\n+        return (index() > HEADER_SIZE) && (index() == getFrameLength());\n+    }\n+\n+    public int remainingSize() {","path":"hazelcast/src/main/java/com/hazelcast/client/impl/protocol/util/ClientMessageAccumulator.java","position":49,"original_position":49,"commit_id":"059ca30484cd457ea0da6fbdb92952fc128aafeb","original_commit_id":"059ca30484cd457ea0da6fbdb92952fc128aafeb","user":{"login":"sancar","id":570462,"avatar_url":"https://avatars.githubusercontent.com/u/570462?v=3","gravatar_id":"","url":"https://api.github.com/users/sancar","html_url":"https://github.com/sancar","followers_url":"https://api.github.com/users/sancar/followers","following_url":"https://api.github.com/users/sancar/following{/other_user}","gists_url":"https://api.github.com/users/sancar/gists{/gist_id}","starred_url":"https://api.github.com/users/sancar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sancar/subscriptions","organizations_url":"https://api.github.com/users/sancar/orgs","repos_url":"https://api.github.com/users/sancar/repos","events_url":"https://api.github.com/users/sancar/events{/privacy}","received_events_url":"https://api.github.com/users/sancar/received_events","type":"User","site_admin":false},"body":"Should this be public?","created_at":"2015-04-03T06:56:18Z","updated_at":"2015-04-03T06:56:18Z","html_url":"https://github.com/hazelcast/hazelcast/pull/4982#discussion_r27717883","pull_request_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4982","_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/27717883"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/4982#discussion_r27717883"},"pull_request":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4982"}}},"pull_request":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4982","id":32533738,"html_url":"https://github.com/hazelcast/hazelcast/pull/4982","diff_url":"https://github.com/hazelcast/hazelcast/pull/4982.diff","patch_url":"https://github.com/hazelcast/hazelcast/pull/4982.patch","issue_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/4982","number":4982,"state":"open","locked":false,"title":"[CP] ClientMessage  and parameter encode-decode improved, unit tests added","user":{"login":"asimarslan","id":2497208,"avatar_url":"https://avatars.githubusercontent.com/u/2497208?v=3","gravatar_id":"","url":"https://api.github.com/users/asimarslan","html_url":"https://github.com/asimarslan","followers_url":"https://api.github.com/users/asimarslan/followers","following_url":"https://api.github.com/users/asimarslan/following{/other_user}","gists_url":"https://api.github.com/users/asimarslan/gists{/gist_id}","starred_url":"https://api.github.com/users/asimarslan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asimarslan/subscriptions","organizations_url":"https://api.github.com/users/asimarslan/orgs","repos_url":"https://api.github.com/users/asimarslan/repos","events_url":"https://api.github.com/users/asimarslan/events{/privacy}","received_events_url":"https://api.github.com/users/asimarslan/received_events","type":"User","site_admin":false},"body":"improves and add unit test for #4970 \r\nAuthentication test\r\nutil tests\r\nCheckstyle suppressions removed with exception to external utils and parameter dto classes","created_at":"2015-04-02T17:46:32Z","updated_at":"2015-04-03T06:56:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f9dd29332a0a380bd2fdfd9a309c6c83c27d9e5","assignee":null,"milestone":{"url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/55","html_url":"https://github.com/hazelcast/hazelcast/milestones/3.5","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/55/labels","id":819785,"number":55,"title":"3.5","description":null,"creator":{"login":"sancar","id":570462,"avatar_url":"https://avatars.githubusercontent.com/u/570462?v=3","gravatar_id":"","url":"https://api.github.com/users/sancar","html_url":"https://github.com/sancar","followers_url":"https://api.github.com/users/sancar/followers","following_url":"https://api.github.com/users/sancar/following{/other_user}","gists_url":"https://api.github.com/users/sancar/gists{/gist_id}","starred_url":"https://api.github.com/users/sancar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sancar/subscriptions","organizations_url":"https://api.github.com/users/sancar/orgs","repos_url":"https://api.github.com/users/sancar/repos","events_url":"https://api.github.com/users/sancar/events{/privacy}","received_events_url":"https://api.github.com/users/sancar/received_events","type":"User","site_admin":false},"open_issues":117,"closed_issues":316,"state":"open","created_at":"2014-10-09T13:04:53Z","updated_at":"2015-04-03T06:42:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4982/commits","review_comments_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4982/comments","review_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/4982/comments","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/059ca30484cd457ea0da6fbdb92952fc128aafeb","head":{"label":"asimarslan:mp2","ref":"mp2","sha":"059ca30484cd457ea0da6fbdb92952fc128aafeb","user":{"login":"asimarslan","id":2497208,"avatar_url":"https://avatars.githubusercontent.com/u/2497208?v=3","gravatar_id":"","url":"https://api.github.com/users/asimarslan","html_url":"https://github.com/asimarslan","followers_url":"https://api.github.com/users/asimarslan/followers","following_url":"https://api.github.com/users/asimarslan/following{/other_user}","gists_url":"https://api.github.com/users/asimarslan/gists{/gist_id}","starred_url":"https://api.github.com/users/asimarslan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asimarslan/subscriptions","organizations_url":"https://api.github.com/users/asimarslan/orgs","repos_url":"https://api.github.com/users/asimarslan/repos","events_url":"https://api.github.com/users/asimarslan/events{/privacy}","received_events_url":"https://api.github.com/users/asimarslan/received_events","type":"User","site_admin":false},"repo":{"id":10238745,"name":"hazelcast","full_name":"asimarslan/hazelcast","owner":{"login":"asimarslan","id":2497208,"avatar_url":"https://avatars.githubusercontent.com/u/2497208?v=3","gravatar_id":"","url":"https://api.github.com/users/asimarslan","html_url":"https://github.com/asimarslan","followers_url":"https://api.github.com/users/asimarslan/followers","following_url":"https://api.github.com/users/asimarslan/following{/other_user}","gists_url":"https://api.github.com/users/asimarslan/gists{/gist_id}","starred_url":"https://api.github.com/users/asimarslan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asimarslan/subscriptions","organizations_url":"https://api.github.com/users/asimarslan/orgs","repos_url":"https://api.github.com/users/asimarslan/repos","events_url":"https://api.github.com/users/asimarslan/events{/privacy}","received_events_url":"https://api.github.com/users/asimarslan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/asimarslan/hazelcast","description":"Open Source In-Memory Data Grid","fork":true,"url":"https://api.github.com/repos/asimarslan/hazelcast","forks_url":"https://api.github.com/repos/asimarslan/hazelcast/forks","keys_url":"https://api.github.com/repos/asimarslan/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asimarslan/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asimarslan/hazelcast/teams","hooks_url":"https://api.github.com/repos/asimarslan/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/asimarslan/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/asimarslan/hazelcast/events","assignees_url":"https://api.github.com/repos/asimarslan/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/asimarslan/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/asimarslan/hazelcast/tags","blobs_url":"https://api.github.com/repos/asimarslan/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asimarslan/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asimarslan/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/asimarslan/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asimarslan/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/asimarslan/hazelcast/languages","stargazers_url":"https://api.github.com/repos/asimarslan/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/asimarslan/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/asimarslan/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/asimarslan/hazelcast/subscription","commits_url":"https://api.github.com/repos/asimarslan/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/asimarslan/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/asimarslan/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/asimarslan/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/asimarslan/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/asimarslan/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asimarslan/hazelcast/merges","archive_url":"https://api.github.com/repos/asimarslan/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asimarslan/hazelcast/downloads","issues_url":"https://api.github.com/repos/asimarslan/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/asimarslan/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/asimarslan/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/asimarslan/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asimarslan/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/asimarslan/hazelcast/releases{/id}","created_at":"2013-05-23T07:56:42Z","updated_at":"2015-04-01T14:20:18Z","pushed_at":"2015-04-02T18:49:33Z","git_url":"git://github.com/asimarslan/hazelcast.git","ssh_url":"git@github.com:asimarslan/hazelcast.git","clone_url":"https://github.com/asimarslan/hazelcast.git","svn_url":"https://github.com/asimarslan/hazelcast","homepage":"www.hazelcast.com","size":62146,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"hazelcast:master","ref":"master","sha":"b0273c7b8bfb373ab336baae7c981f4a79fe3032","user":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"repo":{"id":3786237,"name":"hazelcast","full_name":"hazelcast/hazelcast","owner":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hazelcast/hazelcast","description":"Open Source In-Memory Data Grid","fork":false,"url":"https://api.github.com/repos/hazelcast/hazelcast","forks_url":"https://api.github.com/repos/hazelcast/hazelcast/forks","keys_url":"https://api.github.com/repos/hazelcast/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hazelcast/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hazelcast/hazelcast/teams","hooks_url":"https://api.github.com/repos/hazelcast/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/hazelcast/hazelcast/events","assignees_url":"https://api.github.com/repos/hazelcast/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/hazelcast/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/hazelcast/hazelcast/tags","blobs_url":"https://api.github.com/repos/hazelcast/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hazelcast/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hazelcast/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/hazelcast/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/hazelcast/hazelcast/languages","stargazers_url":"https://api.github.com/repos/hazelcast/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/hazelcast/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/hazelcast/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/hazelcast/hazelcast/subscription","commits_url":"https://api.github.com/repos/hazelcast/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/hazelcast/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/hazelcast/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/hazelcast/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hazelcast/hazelcast/merges","archive_url":"https://api.github.com/repos/hazelcast/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hazelcast/hazelcast/downloads","issues_url":"https://api.github.com/repos/hazelcast/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/hazelcast/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/hazelcast/hazelcast/releases{/id}","created_at":"2012-03-21T12:25:18Z","updated_at":"2015-04-03T05:54:56Z","pushed_at":"2015-04-03T06:21:52Z","git_url":"git://github.com/hazelcast/hazelcast.git","ssh_url":"git@github.com:hazelcast/hazelcast.git","clone_url":"https://github.com/hazelcast/hazelcast.git","svn_url":"https://github.com/hazelcast/hazelcast","homepage":"www.hazelcast.com","size":127490,"stargazers_count":1072,"watchers_count":1072,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":511,"mirror_url":null,"open_issues_count":464,"forks":511,"open_issues":464,"watchers":1072,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4982"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/4982"},"issue":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/4982"},"comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/4982/comments"},"review_comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4982/comments"},"review_comment":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4982/commits"},"statuses":{"href":"https://api.github.com/repos/hazelcast/hazelcast/statuses/059ca30484cd457ea0da6fbdb92952fc128aafeb"}}}}