{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/comments/44899501","id":44899501,"diff_hunk":"@@ -94,24 +99,27 @@ public String getDisplayName() {\n             return \"\";\n         }\n \n-        public FormValidation doCheckApiUrl(@QueryParameter String value) {\n-            if (Util.fixEmptyAndTrim(value) == null) {\n-                return FormValidation.error(\"You must specify the API URI\");\n+        public FormValidation doCheckApiUri(@QueryParameter String apiUri) {\n+            if (Util.fixEmptyAndTrim(apiUri) == null) {\n+                return FormValidation.warning(\"You must specify the API URI\");\n             }\n-            Pattern enterprise = Pattern.compile(\"^https?://(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*\"\n-                    + \"([A-Za-z]|[A-Za-z][A-Za-z0-9\\\\-]*[A-Za-z0-9])/api/v3/?$\");\n-            if (!enterprise.matcher(value).matches()) {\n-                return FormValidation.warning(\n-                        \"This does not look like a GitHub Enterprise API URI. Expecting something like \"\n-                                + \"https://[hostname or ip]/api/v3/\");\n+            try {\n+                URL api = new URL(apiUri);\n+                GitHub github = GitHub.connectToEnterpriseAnonymously(api.toString());\n+                if (github.isApiUrlValid()) {\n+                    return FormValidation.ok();\n+                }\n+                return FormValidation.warning(\"This does not look like a GitHub Enterprise API URI\");\n+            } catch (MalformedURLException mue) {\n+                return FormValidation.error(\"This does not look like a GitHub Enterprise API URI\");\n+            } catch (IOException e) {\n+                return FormValidation.error(e.getMessage());\n             }\n-            // TODO validate connection\n-            return FormValidation.ok();\n         }\n \n-        public FormValidation doCheckApiName(@QueryParameter String value) {\n-            if (Util.fixEmptyAndTrim(value) == null) {\n-                return FormValidation.warning(\"Specifying a name is recommended\");\n+        public FormValidation doCheckName(@QueryParameter String name) {\n+            if (Util.fixEmptyAndTrim(name) == null) {\n+                return FormValidation.warning(\"You must specify the name\");","path":"src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java","position":52,"original_position":52,"commit_id":"b05cadb17e87952955d25c7e91e1e03fa82758c9","original_commit_id":"b05cadb17e87952955d25c7e91e1e03fa82758c9","user":{"login":"recena","id":1021745,"avatar_url":"https://avatars.githubusercontent.com/u/1021745?v=3","gravatar_id":"","url":"https://api.github.com/users/recena","html_url":"https://github.com/recena","followers_url":"https://api.github.com/users/recena/followers","following_url":"https://api.github.com/users/recena/following{/other_user}","gists_url":"https://api.github.com/users/recena/gists{/gist_id}","starred_url":"https://api.github.com/users/recena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recena/subscriptions","organizations_url":"https://api.github.com/users/recena/orgs","repos_url":"https://api.github.com/users/recena/repos","events_url":"https://api.github.com/users/recena/events{/privacy}","received_events_url":"https://api.github.com/users/recena/received_events","type":"User","site_admin":false},"body":"In this method any behavior has changed. Simplify, the validation message. It cannot be a recommendation because is mandatory.","created_at":"2015-11-16T08:51:45Z","updated_at":"2015-11-16T08:51:45Z","html_url":"https://github.com/jenkinsci/github-branch-source-plugin/pull/10#discussion_r44899501","pull_request_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/comments/44899501"},"html":{"href":"https://github.com/jenkinsci/github-branch-source-plugin/pull/10#discussion_r44899501"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/10","id":50749588,"html_url":"https://github.com/jenkinsci/github-branch-source-plugin/pull/10","diff_url":"https://github.com/jenkinsci/github-branch-source-plugin/pull/10.diff","patch_url":"https://github.com/jenkinsci/github-branch-source-plugin/pull/10.patch","issue_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/issues/10","number":10,"state":"open","locked":false,"title":"[JENKINS-31462] GitHub Enterprise Servers validation","user":{"login":"recena","id":1021745,"avatar_url":"https://avatars.githubusercontent.com/u/1021745?v=3","gravatar_id":"","url":"https://api.github.com/users/recena","html_url":"https://github.com/recena","followers_url":"https://api.github.com/users/recena/followers","following_url":"https://api.github.com/users/recena/following{/other_user}","gists_url":"https://api.github.com/users/recena/gists{/gist_id}","starred_url":"https://api.github.com/users/recena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recena/subscriptions","organizations_url":"https://api.github.com/users/recena/orgs","repos_url":"https://api.github.com/users/recena/repos","events_url":"https://api.github.com/users/recena/events{/privacy}","received_events_url":"https://api.github.com/users/recena/received_events","type":"User","site_admin":false},"body":"downstream https://github.com/jenkinsci/github-api-plugin/pull/5\r\n\r\n@reviewbybees especially, @jglick ","created_at":"2015-11-15T16:08:48Z","updated_at":"2015-11-16T08:51:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55a563679c2c1ea17533e2e2282cd6c6e5665e7c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/10/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/10/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/issues/10/comments","statuses_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/statuses/b05cadb17e87952955d25c7e91e1e03fa82758c9","head":{"label":"recena:master","ref":"master","sha":"b05cadb17e87952955d25c7e91e1e03fa82758c9","user":{"login":"recena","id":1021745,"avatar_url":"https://avatars.githubusercontent.com/u/1021745?v=3","gravatar_id":"","url":"https://api.github.com/users/recena","html_url":"https://github.com/recena","followers_url":"https://api.github.com/users/recena/followers","following_url":"https://api.github.com/users/recena/following{/other_user}","gists_url":"https://api.github.com/users/recena/gists{/gist_id}","starred_url":"https://api.github.com/users/recena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recena/subscriptions","organizations_url":"https://api.github.com/users/recena/orgs","repos_url":"https://api.github.com/users/recena/repos","events_url":"https://api.github.com/users/recena/events{/privacy}","received_events_url":"https://api.github.com/users/recena/received_events","type":"User","site_admin":false},"repo":{"id":44967991,"name":"github-branch-source-plugin","full_name":"recena/github-branch-source-plugin","owner":{"login":"recena","id":1021745,"avatar_url":"https://avatars.githubusercontent.com/u/1021745?v=3","gravatar_id":"","url":"https://api.github.com/users/recena","html_url":"https://github.com/recena","followers_url":"https://api.github.com/users/recena/followers","following_url":"https://api.github.com/users/recena/following{/other_user}","gists_url":"https://api.github.com/users/recena/gists{/gist_id}","starred_url":"https://api.github.com/users/recena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/recena/subscriptions","organizations_url":"https://api.github.com/users/recena/orgs","repos_url":"https://api.github.com/users/recena/repos","events_url":"https://api.github.com/users/recena/events{/privacy}","received_events_url":"https://api.github.com/users/recena/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/recena/github-branch-source-plugin","description":"","fork":true,"url":"https://api.github.com/repos/recena/github-branch-source-plugin","forks_url":"https://api.github.com/repos/recena/github-branch-source-plugin/forks","keys_url":"https://api.github.com/repos/recena/github-branch-source-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/recena/github-branch-source-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/recena/github-branch-source-plugin/teams","hooks_url":"https://api.github.com/repos/recena/github-branch-source-plugin/hooks","issue_events_url":"https://api.github.com/repos/recena/github-branch-source-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/recena/github-branch-source-plugin/events","assignees_url":"https://api.github.com/repos/recena/github-branch-source-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/recena/github-branch-source-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/recena/github-branch-source-plugin/tags","blobs_url":"https://api.github.com/repos/recena/github-branch-source-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/recena/github-branch-source-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/recena/github-branch-source-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/recena/github-branch-source-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/recena/github-branch-source-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/recena/github-branch-source-plugin/languages","stargazers_url":"https://api.github.com/repos/recena/github-branch-source-plugin/stargazers","contributors_url":"https://api.github.com/repos/recena/github-branch-source-plugin/contributors","subscribers_url":"https://api.github.com/repos/recena/github-branch-source-plugin/subscribers","subscription_url":"https://api.github.com/repos/recena/github-branch-source-plugin/subscription","commits_url":"https://api.github.com/repos/recena/github-branch-source-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/recena/github-branch-source-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/recena/github-branch-source-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/recena/github-branch-source-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/recena/github-branch-source-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/recena/github-branch-source-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/recena/github-branch-source-plugin/merges","archive_url":"https://api.github.com/repos/recena/github-branch-source-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/recena/github-branch-source-plugin/downloads","issues_url":"https://api.github.com/repos/recena/github-branch-source-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/recena/github-branch-source-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/recena/github-branch-source-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/recena/github-branch-source-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/recena/github-branch-source-plugin/labels{/name}","releases_url":"https://api.github.com/repos/recena/github-branch-source-plugin/releases{/id}","created_at":"2015-10-26T12:50:58Z","updated_at":"2015-10-26T12:50:59Z","pushed_at":"2015-11-15T15:59:51Z","git_url":"git://github.com/recena/github-branch-source-plugin.git","ssh_url":"git@github.com:recena/github-branch-source-plugin.git","clone_url":"https://github.com/recena/github-branch-source-plugin.git","svn_url":"https://github.com/recena/github-branch-source-plugin","homepage":null,"size":0,"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":"jenkinsci:master","ref":"master","sha":"8aefbc7ff3147616d39800b8f9744d3661b6f2b8","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":43903637,"name":"github-branch-source-plugin","full_name":"jenkinsci/github-branch-source-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/github-branch-source-plugin","description":"","fork":true,"url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin","forks_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/releases{/id}","created_at":"2015-10-08T16:52:19Z","updated_at":"2015-10-08T16:52:29Z","pushed_at":"2015-11-15T16:08:49Z","git_url":"git://github.com/jenkinsci/github-branch-source-plugin.git","ssh_url":"git@github.com:jenkinsci/github-branch-source-plugin.git","clone_url":"https://github.com/jenkinsci/github-branch-source-plugin.git","svn_url":"https://github.com/jenkinsci/github-branch-source-plugin","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/10"},"html":{"href":"https://github.com/jenkinsci/github-branch-source-plugin/pull/10"},"issue":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/issues/10"},"comments":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/github-branch-source-plugin/statuses/b05cadb17e87952955d25c7e91e1e03fa82758c9"}}}}