{"action":"created","comment":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/comments/45816453","id":45816453,"diff_hunk":"@@ -906,35 +906,42 @@ private void setUpSSL(boolean validating, HttpsURLConnection securedConnection)\n \t\t\t}\n \t\t}\n \t\tif (sslSocketFactory == null) {\n-\t\t\tif (trustManagers.size() > 0 || keyManagers.size() > 0) {\n-\t\t\t\tTrustManager[] trustManagerArray = null;\n-\t\t\t\tKeyManager[] keyManagerArray = null;\n-\n-\t\t\t\tif (trustManagers.size() > 0) {\n-\t\t\t\t\ttrustManagerArray = new X509TrustManager[trustManagers.size()];\n-\t\t\t\t\ttrustManagerArray = trustManagers.toArray(trustManagerArray);\n-\t\t\t\t}\n-\n-\t\t\t\tif (keyManagers.size() > 0) {\n-\t\t\t\t\tkeyManagerArray = new X509KeyManager[keyManagers.size()];\n-\t\t\t\t\tkeyManagerArray = keyManagers.toArray(keyManagerArray);\n-\t\t\t\t}\n-\n-\t\t\t\ttry {\n-\t\t\t\t\tsslSocketFactory = new TiSocketFactory(keyManagerArray, trustManagerArray, tlsVersion);\n-\t\t\t\t} catch(Exception e) {\n-\t\t\t\t\tLog.e(TAG, \"Error creating SSLSocketFactory: \" + e.getMessage());\n-\t\t\t\t\tsslSocketFactory = null;\n-\t\t\t\t}\n-\t\t\t} else if (!validating) {\n-\t\t\t\tTrustManager trustManagerArray[] = new TrustManager[] { new NonValidatingTrustManager() };\n-\t\t\t\ttry {\n-\t\t\t\t\tsslSocketFactory = new TiSocketFactory(null, trustManagerArray, tlsVersion);\n-\t\t\t\t} catch(Exception e) {\n-\t\t\t\t\tLog.e(TAG, \"Error creating SSLSocketFactory: \" + e.getMessage());\n-\t\t\t\t\tsslSocketFactory = null;\n-\t\t\t\t}\n-\t\t\t}\n+\t\t    if (trustManagers.size() > 0 || keyManagers.size() > 0) {","path":"android/modules/network/src/java/ti/modules/titanium/network/TiHTTPClient.java","position":33,"original_position":33,"commit_id":"d926956e2faef4ebb131061607db07aba318ee26","original_commit_id":"d926956e2faef4ebb131061607db07aba318ee26","user":{"login":"sgtcoolguy","id":3252,"avatar_url":"https://avatars.githubusercontent.com/u/3252?v=3","gravatar_id":"","url":"https://api.github.com/users/sgtcoolguy","html_url":"https://github.com/sgtcoolguy","followers_url":"https://api.github.com/users/sgtcoolguy/followers","following_url":"https://api.github.com/users/sgtcoolguy/following{/other_user}","gists_url":"https://api.github.com/users/sgtcoolguy/gists{/gist_id}","starred_url":"https://api.github.com/users/sgtcoolguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgtcoolguy/subscriptions","organizations_url":"https://api.github.com/users/sgtcoolguy/orgs","repos_url":"https://api.github.com/users/sgtcoolguy/repos","events_url":"https://api.github.com/users/sgtcoolguy/events{/privacy}","received_events_url":"https://api.github.com/users/sgtcoolguy/received_events","type":"User","site_admin":false},"body":"Refactor to avoid duplicating common code?\r\n```java\r\nTrustManager[] trustManagerArray = null;\r\nKeyManager[] keyManagerArray = null;\r\nif (trustManagers.size() > 0 || keyManagers.size() > 0) {\r\n    if (trustManagers.size() > 0) {\r\n        trustManagerArray = new X509TrustManager[trustManagers.size()];\r\n        trustManagerArray = trustManagers.toArray(trustManagerArray);\r\n    }\r\n\r\n    if (keyManagers.size() > 0) {\r\n        keyManagerArray = new X509KeyManager[keyManagers.size()];\r\n        keyManagerArray = keyManagers.toArray(keyManagerArray);\r\n    }\r\n} else if (!validating) {\r\n    trustManagerArray = new TrustManager[] { new NonValidatingTrustManager() };\r\n}\r\ntry {\r\n    sslSocketFactory = new TiSocketFactory(keyManagerArray, trustManagerArray, tlsVersion);\r\n} catch(Exception e) {\r\n    Log.e(TAG, \"Error creating SSLSocketFactory: \" + e.getMessage());\r\n    sslSocketFactory = null;\r\n}\r\n```","created_at":"2015-11-25T00:40:13Z","updated_at":"2015-11-25T00:40:13Z","html_url":"https://github.com/appcelerator/titanium_mobile/pull/7493#discussion_r45816453","pull_request_url":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7493","_links":{"self":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/comments/45816453"},"html":{"href":"https://github.com/appcelerator/titanium_mobile/pull/7493#discussion_r45816453"},"pull_request":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7493"}}},"pull_request":{"url":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7493","id":51728885,"html_url":"https://github.com/appcelerator/titanium_mobile/pull/7493","diff_url":"https://github.com/appcelerator/titanium_mobile/pull/7493.diff","patch_url":"https://github.com/appcelerator/titanium_mobile/pull/7493.patch","issue_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7493","number":7493,"state":"open","locked":false,"title":"[TIMOB-20061]: Set TLS properly when validatesSecureCert is true.","user":{"login":"hieupham007","id":1141803,"avatar_url":"https://avatars.githubusercontent.com/u/1141803?v=3","gravatar_id":"","url":"https://api.github.com/users/hieupham007","html_url":"https://github.com/hieupham007","followers_url":"https://api.github.com/users/hieupham007/followers","following_url":"https://api.github.com/users/hieupham007/following{/other_user}","gists_url":"https://api.github.com/users/hieupham007/gists{/gist_id}","starred_url":"https://api.github.com/users/hieupham007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hieupham007/subscriptions","organizations_url":"https://api.github.com/users/hieupham007/orgs","repos_url":"https://api.github.com/users/hieupham007/repos","events_url":"https://api.github.com/users/hieupham007/events{/privacy}","received_events_url":"https://api.github.com/users/hieupham007/received_events","type":"User","site_admin":false},"body":"Testing steps in JIRA: https://jira.appcelerator.org/browse/TIMOB-20061","created_at":"2015-11-24T22:49:07Z","updated_at":"2015-11-25T00:40:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e025945eb29cf13c5a3e7e8078b56d851247292","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7493/commits","review_comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7493/comments","review_comment_url":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7493/comments","statuses_url":"https://api.github.com/repos/appcelerator/titanium_mobile/statuses/d926956e2faef4ebb131061607db07aba318ee26","head":{"label":"hieupham007:timob-20061","ref":"timob-20061","sha":"d926956e2faef4ebb131061607db07aba318ee26","user":{"login":"hieupham007","id":1141803,"avatar_url":"https://avatars.githubusercontent.com/u/1141803?v=3","gravatar_id":"","url":"https://api.github.com/users/hieupham007","html_url":"https://github.com/hieupham007","followers_url":"https://api.github.com/users/hieupham007/followers","following_url":"https://api.github.com/users/hieupham007/following{/other_user}","gists_url":"https://api.github.com/users/hieupham007/gists{/gist_id}","starred_url":"https://api.github.com/users/hieupham007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hieupham007/subscriptions","organizations_url":"https://api.github.com/users/hieupham007/orgs","repos_url":"https://api.github.com/users/hieupham007/repos","events_url":"https://api.github.com/users/hieupham007/events{/privacy}","received_events_url":"https://api.github.com/users/hieupham007/received_events","type":"User","site_admin":false},"repo":{"id":2616536,"name":"Titanium_Mobile","full_name":"hieupham007/Titanium_Mobile","owner":{"login":"hieupham007","id":1141803,"avatar_url":"https://avatars.githubusercontent.com/u/1141803?v=3","gravatar_id":"","url":"https://api.github.com/users/hieupham007","html_url":"https://github.com/hieupham007","followers_url":"https://api.github.com/users/hieupham007/followers","following_url":"https://api.github.com/users/hieupham007/following{/other_user}","gists_url":"https://api.github.com/users/hieupham007/gists{/gist_id}","starred_url":"https://api.github.com/users/hieupham007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hieupham007/subscriptions","organizations_url":"https://api.github.com/users/hieupham007/orgs","repos_url":"https://api.github.com/users/hieupham007/repos","events_url":"https://api.github.com/users/hieupham007/events{/privacy}","received_events_url":"https://api.github.com/users/hieupham007/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hieupham007/Titanium_Mobile","description":"Appcelerator Titanium Mobile","fork":true,"url":"https://api.github.com/repos/hieupham007/Titanium_Mobile","forks_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/forks","keys_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/teams","hooks_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/hooks","issue_events_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/issues/events{/number}","events_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/events","assignees_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/assignees{/user}","branches_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/branches{/branch}","tags_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/tags","blobs_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/languages","stargazers_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/stargazers","contributors_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/contributors","subscribers_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/subscribers","subscription_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/subscription","commits_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/contents/{+path}","compare_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/merges","archive_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/downloads","issues_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/issues{/number}","pulls_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/labels{/name}","releases_url":"https://api.github.com/repos/hieupham007/Titanium_Mobile/releases{/id}","created_at":"2011-10-20T21:52:11Z","updated_at":"2014-09-03T10:17:39Z","pushed_at":"2015-11-24T22:48:28Z","git_url":"git://github.com/hieupham007/Titanium_Mobile.git","ssh_url":"git@github.com:hieupham007/Titanium_Mobile.git","clone_url":"https://github.com/hieupham007/Titanium_Mobile.git","svn_url":"https://github.com/hieupham007/Titanium_Mobile","homepage":"http://www.appcelerator.com","size":882797,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":0,"forks":4,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"appcelerator:master","ref":"master","sha":"1003773170f9e2878a401aa01a3013816dd528fa","user":{"login":"appcelerator","id":82188,"avatar_url":"https://avatars.githubusercontent.com/u/82188?v=3","gravatar_id":"","url":"https://api.github.com/users/appcelerator","html_url":"https://github.com/appcelerator","followers_url":"https://api.github.com/users/appcelerator/followers","following_url":"https://api.github.com/users/appcelerator/following{/other_user}","gists_url":"https://api.github.com/users/appcelerator/gists{/gist_id}","starred_url":"https://api.github.com/users/appcelerator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appcelerator/subscriptions","organizations_url":"https://api.github.com/users/appcelerator/orgs","repos_url":"https://api.github.com/users/appcelerator/repos","events_url":"https://api.github.com/users/appcelerator/events{/privacy}","received_events_url":"https://api.github.com/users/appcelerator/received_events","type":"Organization","site_admin":false},"repo":{"id":228094,"name":"titanium_mobile","full_name":"appcelerator/titanium_mobile","owner":{"login":"appcelerator","id":82188,"avatar_url":"https://avatars.githubusercontent.com/u/82188?v=3","gravatar_id":"","url":"https://api.github.com/users/appcelerator","html_url":"https://github.com/appcelerator","followers_url":"https://api.github.com/users/appcelerator/followers","following_url":"https://api.github.com/users/appcelerator/following{/other_user}","gists_url":"https://api.github.com/users/appcelerator/gists{/gist_id}","starred_url":"https://api.github.com/users/appcelerator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appcelerator/subscriptions","organizations_url":"https://api.github.com/users/appcelerator/orgs","repos_url":"https://api.github.com/users/appcelerator/repos","events_url":"https://api.github.com/users/appcelerator/events{/privacy}","received_events_url":"https://api.github.com/users/appcelerator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appcelerator/titanium_mobile","description":"Appcelerator Titanium Mobile","fork":false,"url":"https://api.github.com/repos/appcelerator/titanium_mobile","forks_url":"https://api.github.com/repos/appcelerator/titanium_mobile/forks","keys_url":"https://api.github.com/repos/appcelerator/titanium_mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appcelerator/titanium_mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appcelerator/titanium_mobile/teams","hooks_url":"https://api.github.com/repos/appcelerator/titanium_mobile/hooks","issue_events_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/events{/number}","events_url":"https://api.github.com/repos/appcelerator/titanium_mobile/events","assignees_url":"https://api.github.com/repos/appcelerator/titanium_mobile/assignees{/user}","branches_url":"https://api.github.com/repos/appcelerator/titanium_mobile/branches{/branch}","tags_url":"https://api.github.com/repos/appcelerator/titanium_mobile/tags","blobs_url":"https://api.github.com/repos/appcelerator/titanium_mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appcelerator/titanium_mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appcelerator/titanium_mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/appcelerator/titanium_mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appcelerator/titanium_mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/appcelerator/titanium_mobile/languages","stargazers_url":"https://api.github.com/repos/appcelerator/titanium_mobile/stargazers","contributors_url":"https://api.github.com/repos/appcelerator/titanium_mobile/contributors","subscribers_url":"https://api.github.com/repos/appcelerator/titanium_mobile/subscribers","subscription_url":"https://api.github.com/repos/appcelerator/titanium_mobile/subscription","commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/appcelerator/titanium_mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/appcelerator/titanium_mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/appcelerator/titanium_mobile/contents/{+path}","compare_url":"https://api.github.com/repos/appcelerator/titanium_mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appcelerator/titanium_mobile/merges","archive_url":"https://api.github.com/repos/appcelerator/titanium_mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appcelerator/titanium_mobile/downloads","issues_url":"https://api.github.com/repos/appcelerator/titanium_mobile/issues{/number}","pulls_url":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/appcelerator/titanium_mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/appcelerator/titanium_mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appcelerator/titanium_mobile/labels{/name}","releases_url":"https://api.github.com/repos/appcelerator/titanium_mobile/releases{/id}","created_at":"2009-06-15T22:54:37Z","updated_at":"2015-11-24T07:06:45Z","pushed_at":"2015-11-25T00:35:17Z","git_url":"git://github.com/appcelerator/titanium_mobile.git","ssh_url":"git@github.com:appcelerator/titanium_mobile.git","clone_url":"https://github.com/appcelerator/titanium_mobile.git","svn_url":"https://github.com/appcelerator/titanium_mobile","homepage":"http://www.appcelerator.com","size":1016743,"stargazers_count":1988,"watchers_count":1988,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1061,"mirror_url":null,"open_issues_count":81,"forks":1061,"open_issues":81,"watchers":1988,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7493"},"html":{"href":"https://github.com/appcelerator/titanium_mobile/pull/7493"},"issue":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7493"},"comments":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/issues/7493/comments"},"review_comments":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7493/comments"},"review_comment":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/pulls/7493/commits"},"statuses":{"href":"https://api.github.com/repos/appcelerator/titanium_mobile/statuses/d926956e2faef4ebb131061607db07aba318ee26"}}}}