{"action":"closed","number":307,"pull_request":{"url":"https://api.github.com/repos/twilio/twilio-java/pulls/307","id":95569246,"html_url":"https://github.com/twilio/twilio-java/pull/307","diff_url":"https://github.com/twilio/twilio-java/pull/307.diff","patch_url":"https://github.com/twilio/twilio-java/pull/307.patch","issue_url":"https://api.github.com/repos/twilio/twilio-java/issues/307","number":307,"state":"closed","locked":false,"title":"Fix NPE vulnerability in ApiException getCode/getStatusCode","user":{"login":"jimm-porch","id":8631234,"avatar_url":"https://avatars.githubusercontent.com/u/8631234?v=3","gravatar_id":"","url":"https://api.github.com/users/jimm-porch","html_url":"https://github.com/jimm-porch","followers_url":"https://api.github.com/users/jimm-porch/followers","following_url":"https://api.github.com/users/jimm-porch/following{/other_user}","gists_url":"https://api.github.com/users/jimm-porch/gists{/gist_id}","starred_url":"https://api.github.com/users/jimm-porch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimm-porch/subscriptions","organizations_url":"https://api.github.com/users/jimm-porch/orgs","repos_url":"https://api.github.com/users/jimm-porch/repos","events_url":"https://api.github.com/users/jimm-porch/events{/privacy}","received_events_url":"https://api.github.com/users/jimm-porch/received_events","type":"User","site_admin":false},"body":"The `ApiException` class allows you to pass `null` for `status` and `code` parameters.  These are stored inside the class as `java.lang.Integer`, which is fine since that is nullable.\r\n\r\nBut when you ask the exception for its code or status, those getters return primitive `int`, which throws a `NullPointerException` if the underlying value is null.  For example, this throws a NPE:\r\n\r\n```java\r\nApiException e = new ApiException(“danger”);\r\ne.getCode();\r\n```\r\n\r\nThere are three constructors, and two of them explicitly pass `null` for these fields, which means you can safely construct an `ApiException` that will bomb later when someone innocently asks for its status or code.\r\n\r\nThis PR changes the result types on `getCode()` and `getStatusCode()` from primitive `int` to `java.lang.Integer`.\r\n\r\nThere is another exception in the same package called `RestException` that also has these two fields, but it has safe getters which return nullable values instead of primitive `int`, so this pattern has already been applied elsewhere in the SDK.\r\n\r\n","created_at":"2016-11-28T20:18:46Z","updated_at":"2016-11-30T21:17:17Z","closed_at":"2016-11-30T21:17:17Z","merged_at":"2016-11-30T21:17:17Z","merge_commit_sha":"d62c56996eff5eca4e94a44097503e5ef2ed2320","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/twilio/twilio-java/pulls/307/commits","review_comments_url":"https://api.github.com/repos/twilio/twilio-java/pulls/307/comments","review_comment_url":"https://api.github.com/repos/twilio/twilio-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/twilio/twilio-java/issues/307/comments","statuses_url":"https://api.github.com/repos/twilio/twilio-java/statuses/2f5f63c819f00d48813a30b2fd0c6189db638289","head":{"label":"jimm-porch:npeApiException","ref":"npeApiException","sha":"2f5f63c819f00d48813a30b2fd0c6189db638289","user":{"login":"jimm-porch","id":8631234,"avatar_url":"https://avatars.githubusercontent.com/u/8631234?v=3","gravatar_id":"","url":"https://api.github.com/users/jimm-porch","html_url":"https://github.com/jimm-porch","followers_url":"https://api.github.com/users/jimm-porch/followers","following_url":"https://api.github.com/users/jimm-porch/following{/other_user}","gists_url":"https://api.github.com/users/jimm-porch/gists{/gist_id}","starred_url":"https://api.github.com/users/jimm-porch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimm-porch/subscriptions","organizations_url":"https://api.github.com/users/jimm-porch/orgs","repos_url":"https://api.github.com/users/jimm-porch/repos","events_url":"https://api.github.com/users/jimm-porch/events{/privacy}","received_events_url":"https://api.github.com/users/jimm-porch/received_events","type":"User","site_admin":false},"repo":{"id":75010285,"name":"twilio-java","full_name":"jimm-porch/twilio-java","owner":{"login":"jimm-porch","id":8631234,"avatar_url":"https://avatars.githubusercontent.com/u/8631234?v=3","gravatar_id":"","url":"https://api.github.com/users/jimm-porch","html_url":"https://github.com/jimm-porch","followers_url":"https://api.github.com/users/jimm-porch/followers","following_url":"https://api.github.com/users/jimm-porch/following{/other_user}","gists_url":"https://api.github.com/users/jimm-porch/gists{/gist_id}","starred_url":"https://api.github.com/users/jimm-porch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimm-porch/subscriptions","organizations_url":"https://api.github.com/users/jimm-porch/orgs","repos_url":"https://api.github.com/users/jimm-porch/repos","events_url":"https://api.github.com/users/jimm-porch/events{/privacy}","received_events_url":"https://api.github.com/users/jimm-porch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jimm-porch/twilio-java","description":"A Java library for communicating with the Twilio REST API and generating TwiML.","fork":true,"url":"https://api.github.com/repos/jimm-porch/twilio-java","forks_url":"https://api.github.com/repos/jimm-porch/twilio-java/forks","keys_url":"https://api.github.com/repos/jimm-porch/twilio-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jimm-porch/twilio-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jimm-porch/twilio-java/teams","hooks_url":"https://api.github.com/repos/jimm-porch/twilio-java/hooks","issue_events_url":"https://api.github.com/repos/jimm-porch/twilio-java/issues/events{/number}","events_url":"https://api.github.com/repos/jimm-porch/twilio-java/events","assignees_url":"https://api.github.com/repos/jimm-porch/twilio-java/assignees{/user}","branches_url":"https://api.github.com/repos/jimm-porch/twilio-java/branches{/branch}","tags_url":"https://api.github.com/repos/jimm-porch/twilio-java/tags","blobs_url":"https://api.github.com/repos/jimm-porch/twilio-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jimm-porch/twilio-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jimm-porch/twilio-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/jimm-porch/twilio-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jimm-porch/twilio-java/statuses/{sha}","languages_url":"https://api.github.com/repos/jimm-porch/twilio-java/languages","stargazers_url":"https://api.github.com/repos/jimm-porch/twilio-java/stargazers","contributors_url":"https://api.github.com/repos/jimm-porch/twilio-java/contributors","subscribers_url":"https://api.github.com/repos/jimm-porch/twilio-java/subscribers","subscription_url":"https://api.github.com/repos/jimm-porch/twilio-java/subscription","commits_url":"https://api.github.com/repos/jimm-porch/twilio-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/jimm-porch/twilio-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/jimm-porch/twilio-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/jimm-porch/twilio-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/jimm-porch/twilio-java/contents/{+path}","compare_url":"https://api.github.com/repos/jimm-porch/twilio-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jimm-porch/twilio-java/merges","archive_url":"https://api.github.com/repos/jimm-porch/twilio-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jimm-porch/twilio-java/downloads","issues_url":"https://api.github.com/repos/jimm-porch/twilio-java/issues{/number}","pulls_url":"https://api.github.com/repos/jimm-porch/twilio-java/pulls{/number}","milestones_url":"https://api.github.com/repos/jimm-porch/twilio-java/milestones{/number}","notifications_url":"https://api.github.com/repos/jimm-porch/twilio-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jimm-porch/twilio-java/labels{/name}","releases_url":"https://api.github.com/repos/jimm-porch/twilio-java/releases{/id}","deployments_url":"https://api.github.com/repos/jimm-porch/twilio-java/deployments","created_at":"2016-11-28T20:11:49Z","updated_at":"2016-11-28T20:11:53Z","pushed_at":"2016-11-28T20:16:10Z","git_url":"git://github.com/jimm-porch/twilio-java.git","ssh_url":"git@github.com:jimm-porch/twilio-java.git","clone_url":"https://github.com/jimm-porch/twilio-java.git","svn_url":"https://github.com/jimm-porch/twilio-java","homepage":"https://www.twilio.com/docs/libraries/java","size":31212,"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":"twilio:master","ref":"master","sha":"7be783986b4c75e21978d80267e44fc597616bfa","user":{"login":"twilio","id":109142,"avatar_url":"https://avatars.githubusercontent.com/u/109142?v=3","gravatar_id":"","url":"https://api.github.com/users/twilio","html_url":"https://github.com/twilio","followers_url":"https://api.github.com/users/twilio/followers","following_url":"https://api.github.com/users/twilio/following{/other_user}","gists_url":"https://api.github.com/users/twilio/gists{/gist_id}","starred_url":"https://api.github.com/users/twilio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twilio/subscriptions","organizations_url":"https://api.github.com/users/twilio/orgs","repos_url":"https://api.github.com/users/twilio/repos","events_url":"https://api.github.com/users/twilio/events{/privacy}","received_events_url":"https://api.github.com/users/twilio/received_events","type":"Organization","site_admin":false},"repo":{"id":307476,"name":"twilio-java","full_name":"twilio/twilio-java","owner":{"login":"twilio","id":109142,"avatar_url":"https://avatars.githubusercontent.com/u/109142?v=3","gravatar_id":"","url":"https://api.github.com/users/twilio","html_url":"https://github.com/twilio","followers_url":"https://api.github.com/users/twilio/followers","following_url":"https://api.github.com/users/twilio/following{/other_user}","gists_url":"https://api.github.com/users/twilio/gists{/gist_id}","starred_url":"https://api.github.com/users/twilio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twilio/subscriptions","organizations_url":"https://api.github.com/users/twilio/orgs","repos_url":"https://api.github.com/users/twilio/repos","events_url":"https://api.github.com/users/twilio/events{/privacy}","received_events_url":"https://api.github.com/users/twilio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twilio/twilio-java","description":"A Java library for communicating with the Twilio REST API and generating TwiML.","fork":false,"url":"https://api.github.com/repos/twilio/twilio-java","forks_url":"https://api.github.com/repos/twilio/twilio-java/forks","keys_url":"https://api.github.com/repos/twilio/twilio-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twilio/twilio-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twilio/twilio-java/teams","hooks_url":"https://api.github.com/repos/twilio/twilio-java/hooks","issue_events_url":"https://api.github.com/repos/twilio/twilio-java/issues/events{/number}","events_url":"https://api.github.com/repos/twilio/twilio-java/events","assignees_url":"https://api.github.com/repos/twilio/twilio-java/assignees{/user}","branches_url":"https://api.github.com/repos/twilio/twilio-java/branches{/branch}","tags_url":"https://api.github.com/repos/twilio/twilio-java/tags","blobs_url":"https://api.github.com/repos/twilio/twilio-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twilio/twilio-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twilio/twilio-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/twilio/twilio-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twilio/twilio-java/statuses/{sha}","languages_url":"https://api.github.com/repos/twilio/twilio-java/languages","stargazers_url":"https://api.github.com/repos/twilio/twilio-java/stargazers","contributors_url":"https://api.github.com/repos/twilio/twilio-java/contributors","subscribers_url":"https://api.github.com/repos/twilio/twilio-java/subscribers","subscription_url":"https://api.github.com/repos/twilio/twilio-java/subscription","commits_url":"https://api.github.com/repos/twilio/twilio-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/twilio/twilio-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/twilio/twilio-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/twilio/twilio-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/twilio/twilio-java/contents/{+path}","compare_url":"https://api.github.com/repos/twilio/twilio-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twilio/twilio-java/merges","archive_url":"https://api.github.com/repos/twilio/twilio-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twilio/twilio-java/downloads","issues_url":"https://api.github.com/repos/twilio/twilio-java/issues{/number}","pulls_url":"https://api.github.com/repos/twilio/twilio-java/pulls{/number}","milestones_url":"https://api.github.com/repos/twilio/twilio-java/milestones{/number}","notifications_url":"https://api.github.com/repos/twilio/twilio-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twilio/twilio-java/labels{/name}","releases_url":"https://api.github.com/repos/twilio/twilio-java/releases{/id}","deployments_url":"https://api.github.com/repos/twilio/twilio-java/deployments","created_at":"2009-09-15T06:04:28Z","updated_at":"2016-11-29T18:02:43Z","pushed_at":"2016-11-30T21:17:17Z","git_url":"git://github.com/twilio/twilio-java.git","ssh_url":"git@github.com:twilio/twilio-java.git","clone_url":"https://github.com/twilio/twilio-java.git","svn_url":"https://github.com/twilio/twilio-java","homepage":"https://www.twilio.com/docs/libraries/java","size":31970,"stargazers_count":233,"watchers_count":233,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":199,"mirror_url":null,"open_issues_count":15,"forks":199,"open_issues":15,"watchers":233,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/twilio/twilio-java/pulls/307"},"html":{"href":"https://github.com/twilio/twilio-java/pull/307"},"issue":{"href":"https://api.github.com/repos/twilio/twilio-java/issues/307"},"comments":{"href":"https://api.github.com/repos/twilio/twilio-java/issues/307/comments"},"review_comments":{"href":"https://api.github.com/repos/twilio/twilio-java/pulls/307/comments"},"review_comment":{"href":"https://api.github.com/repos/twilio/twilio-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/twilio/twilio-java/pulls/307/commits"},"statuses":{"href":"https://api.github.com/repos/twilio/twilio-java/statuses/2f5f63c819f00d48813a30b2fd0c6189db638289"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"jingming","id":1530951,"avatar_url":"https://avatars.githubusercontent.com/u/1530951?v=3","gravatar_id":"","url":"https://api.github.com/users/jingming","html_url":"https://github.com/jingming","followers_url":"https://api.github.com/users/jingming/followers","following_url":"https://api.github.com/users/jingming/following{/other_user}","gists_url":"https://api.github.com/users/jingming/gists{/gist_id}","starred_url":"https://api.github.com/users/jingming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jingming/subscriptions","organizations_url":"https://api.github.com/users/jingming/orgs","repos_url":"https://api.github.com/users/jingming/repos","events_url":"https://api.github.com/users/jingming/events{/privacy}","received_events_url":"https://api.github.com/users/jingming/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":1,"additions":55,"deletions":2,"changed_files":2}}
{"actor":{"display_login":"jingming"}}