{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/54639174","id":54639174,"diff_hunk":"@@ -189,9 +189,9 @@ class ClientQuotaManager(private val config: ClientQuotaManagerConfig,\n     }\n \n     /* If the sensor is null, try to create it else return the created sensor\n-     * Also if quota sensor is null, the throttle time sensor must be null\n+     * Either of the sensors can be null, hence null checks on both\n      */\n-    if (quotaSensor == null) {\n+    if (quotaSensor == null || throttleTimeSensor == null) {","path":"core/src/main/scala/kafka/server/ClientQuotaManager.scala","position":23,"original_position":23,"commit_id":"cd5007eb3c94ae2d1983cc6a4b9a9fe4e96ff1b1","original_commit_id":"cd5007eb3c94ae2d1983cc6a4b9a9fe4e96ff1b1","user":{"login":"becketqin","id":5778611,"avatar_url":"https://avatars.githubusercontent.com/u/5778611?v=3","gravatar_id":"","url":"https://api.github.com/users/becketqin","html_url":"https://github.com/becketqin","followers_url":"https://api.github.com/users/becketqin/followers","following_url":"https://api.github.com/users/becketqin/following{/other_user}","gists_url":"https://api.github.com/users/becketqin/gists{/gist_id}","starred_url":"https://api.github.com/users/becketqin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/becketqin/subscriptions","organizations_url":"https://api.github.com/users/becketqin/orgs","repos_url":"https://api.github.com/users/becketqin/repos","events_url":"https://api.github.com/users/becketqin/events{/privacy}","received_events_url":"https://api.github.com/users/becketqin/received_events","type":"User","site_admin":false},"body":"Can this be simplified to just use two parallel ```if``` statement?","created_at":"2016-03-01T21:32:23Z","updated_at":"2016-03-01T21:32:23Z","html_url":"https://github.com/apache/kafka/pull/989#discussion_r54639174","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/989","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/54639174"},"html":{"href":"https://github.com/apache/kafka/pull/989#discussion_r54639174"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/989"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/989","id":61303183,"html_url":"https://github.com/apache/kafka/pull/989","diff_url":"https://github.com/apache/kafka/pull/989.diff","patch_url":"https://github.com/apache/kafka/pull/989.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/989","number":989,"state":"open","locked":false,"title":"KAFKA-3310: Fix for NPEs observed when throttling clients.","user":{"login":"auradkar","id":877969,"avatar_url":"https://avatars.githubusercontent.com/u/877969?v=3","gravatar_id":"","url":"https://api.github.com/users/auradkar","html_url":"https://github.com/auradkar","followers_url":"https://api.github.com/users/auradkar/followers","following_url":"https://api.github.com/users/auradkar/following{/other_user}","gists_url":"https://api.github.com/users/auradkar/gists{/gist_id}","starred_url":"https://api.github.com/users/auradkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auradkar/subscriptions","organizations_url":"https://api.github.com/users/auradkar/orgs","repos_url":"https://api.github.com/users/auradkar/repos","events_url":"https://api.github.com/users/auradkar/events{/privacy}","received_events_url":"https://api.github.com/users/auradkar/received_events","type":"User","site_admin":false},"body":"The fix basically ensures that the throttleTimeSensor is non-null before handing off to record the metric value. We also record the throttle time to 0 so that we don't recreate the sensor always.","created_at":"2016-03-01T20:29:23Z","updated_at":"2016-03-01T21:32:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12e22f11bf4158873f89bb245d43527e851421e9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/989/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/989/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/989/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/cd5007eb3c94ae2d1983cc6a4b9a9fe4e96ff1b1","head":{"label":"auradkar:KAFKA-3310","ref":"KAFKA-3310","sha":"cd5007eb3c94ae2d1983cc6a4b9a9fe4e96ff1b1","user":{"login":"auradkar","id":877969,"avatar_url":"https://avatars.githubusercontent.com/u/877969?v=3","gravatar_id":"","url":"https://api.github.com/users/auradkar","html_url":"https://github.com/auradkar","followers_url":"https://api.github.com/users/auradkar/followers","following_url":"https://api.github.com/users/auradkar/following{/other_user}","gists_url":"https://api.github.com/users/auradkar/gists{/gist_id}","starred_url":"https://api.github.com/users/auradkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auradkar/subscriptions","organizations_url":"https://api.github.com/users/auradkar/orgs","repos_url":"https://api.github.com/users/auradkar/repos","events_url":"https://api.github.com/users/auradkar/events{/privacy}","received_events_url":"https://api.github.com/users/auradkar/received_events","type":"User","site_admin":false},"repo":{"id":41048608,"name":"kafka","full_name":"auradkar/kafka","owner":{"login":"auradkar","id":877969,"avatar_url":"https://avatars.githubusercontent.com/u/877969?v=3","gravatar_id":"","url":"https://api.github.com/users/auradkar","html_url":"https://github.com/auradkar","followers_url":"https://api.github.com/users/auradkar/followers","following_url":"https://api.github.com/users/auradkar/following{/other_user}","gists_url":"https://api.github.com/users/auradkar/gists{/gist_id}","starred_url":"https://api.github.com/users/auradkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auradkar/subscriptions","organizations_url":"https://api.github.com/users/auradkar/orgs","repos_url":"https://api.github.com/users/auradkar/repos","events_url":"https://api.github.com/users/auradkar/events{/privacy}","received_events_url":"https://api.github.com/users/auradkar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/auradkar/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/auradkar/kafka","forks_url":"https://api.github.com/repos/auradkar/kafka/forks","keys_url":"https://api.github.com/repos/auradkar/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/auradkar/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/auradkar/kafka/teams","hooks_url":"https://api.github.com/repos/auradkar/kafka/hooks","issue_events_url":"https://api.github.com/repos/auradkar/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/auradkar/kafka/events","assignees_url":"https://api.github.com/repos/auradkar/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/auradkar/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/auradkar/kafka/tags","blobs_url":"https://api.github.com/repos/auradkar/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/auradkar/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/auradkar/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/auradkar/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/auradkar/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/auradkar/kafka/languages","stargazers_url":"https://api.github.com/repos/auradkar/kafka/stargazers","contributors_url":"https://api.github.com/repos/auradkar/kafka/contributors","subscribers_url":"https://api.github.com/repos/auradkar/kafka/subscribers","subscription_url":"https://api.github.com/repos/auradkar/kafka/subscription","commits_url":"https://api.github.com/repos/auradkar/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/auradkar/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/auradkar/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/auradkar/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/auradkar/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/auradkar/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/auradkar/kafka/merges","archive_url":"https://api.github.com/repos/auradkar/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/auradkar/kafka/downloads","issues_url":"https://api.github.com/repos/auradkar/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/auradkar/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/auradkar/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/auradkar/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/auradkar/kafka/labels{/name}","releases_url":"https://api.github.com/repos/auradkar/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/auradkar/kafka/deployments","created_at":"2015-08-19T17:16:35Z","updated_at":"2016-01-28T22:52:21Z","pushed_at":"2016-03-01T20:27:36Z","git_url":"git://github.com/auradkar/kafka.git","ssh_url":"git@github.com:auradkar/kafka.git","clone_url":"https://github.com/auradkar/kafka.git","svn_url":"https://github.com/auradkar/kafka","homepage":null,"size":26710,"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":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"695fdc69db6e080419bb05d624e91fa88d5c0a02","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2211243,"name":"kafka","full_name":"apache/kafka","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/apache/kafka/deployments","created_at":"2011-08-15T18:06:16Z","updated_at":"2016-03-01T21:24:55Z","pushed_at":"2016-03-01T20:29:24Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":35086,"stargazers_count":2689,"watchers_count":2689,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1627,"mirror_url":"git://git.apache.org/kafka.git","open_issues_count":141,"forks":1627,"open_issues":141,"watchers":2689,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/989"},"html":{"href":"https://github.com/apache/kafka/pull/989"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/989"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/989/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/989/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/989/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/cd5007eb3c94ae2d1983cc6a4b9a9fe4e96ff1b1"}}}}