{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/comments/86277024","pull_request_review_id":6942501,"id":86277024,"diff_hunk":"@@ -0,0 +1,72 @@\n+/*\n+ * Copyright 2016 Google Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.google.cloud.tools.eclipse.util.io;\n+\n+import com.google.common.annotations.VisibleForTesting;\n+import java.io.IOException;\n+import java.net.ServerSocket;\n+import java.util.ArrayList;\n+import java.util.Collections;\n+import java.util.List;\n+\n+public class SocketUtil {\n+\n+  /**\n+   * @param portCount the number of free ports to find\n+   * @return a list of free ports whose length is {@code portCount} if it was able to find\n+   *     {@code portCount} free ports; an empty list if it could not fulfill the request or\n+   *     {@code portCount} was negative or 0\n+   */\n+  public static List<Integer> findFreePorts(int portCount) {","path":"plugins/com.google.cloud.tools.eclipse.util/src/com/google/cloud/tools/eclipse/util/io/SocketUtil.java","position":34,"original_position":34,"commit_id":"27bfce704fd5ad1fb6e127d62a5d3de23364d815","original_commit_id":"27bfce704fd5ad1fb6e127d62a5d3de23364d815","user":{"login":"chanseokoh","id":10523105,"avatar_url":"https://avatars.githubusercontent.com/u/10523105?v=3","gravatar_id":"","url":"https://api.github.com/users/chanseokoh","html_url":"https://github.com/chanseokoh","followers_url":"https://api.github.com/users/chanseokoh/followers","following_url":"https://api.github.com/users/chanseokoh/following{/other_user}","gists_url":"https://api.github.com/users/chanseokoh/gists{/gist_id}","starred_url":"https://api.github.com/users/chanseokoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chanseokoh/subscriptions","organizations_url":"https://api.github.com/users/chanseokoh/orgs","repos_url":"https://api.github.com/users/chanseokoh/repos","events_url":"https://api.github.com/users/chanseokoh/events{/privacy}","received_events_url":"https://api.github.com/users/chanseokoh/received_events","type":"User","site_admin":false},"body":"There is a situation where we need two ports: one for the service port and the other for the admin port. FYI, we don't want to let dev_appserver.py do this, because otherwise we have to parse the unformatted server output to know which free ports it picked up.","created_at":"2016-11-03T01:51:06Z","updated_at":"2016-11-03T01:51:06Z","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse/pull/938#discussion_r86277024","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/938","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/comments/86277024"},"html":{"href":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse/pull/938#discussion_r86277024"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/938"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/938","id":92055269,"html_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse/pull/938","diff_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse/pull/938.diff","patch_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse/pull/938.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues/938","number":938,"state":"open","locked":false,"title":"Check and set server port and admin port of dev app server","user":{"login":"chanseokoh","id":10523105,"avatar_url":"https://avatars.githubusercontent.com/u/10523105?v=3","gravatar_id":"","url":"https://api.github.com/users/chanseokoh","html_url":"https://github.com/chanseokoh","followers_url":"https://api.github.com/users/chanseokoh/followers","following_url":"https://api.github.com/users/chanseokoh/following{/other_user}","gists_url":"https://api.github.com/users/chanseokoh/gists{/gist_id}","starred_url":"https://api.github.com/users/chanseokoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chanseokoh/subscriptions","organizations_url":"https://api.github.com/users/chanseokoh/orgs","repos_url":"https://api.github.com/users/chanseokoh/repos","events_url":"https://api.github.com/users/chanseokoh/events{/privacy}","received_events_url":"https://api.github.com/users/chanseokoh/received_events","type":"User","site_admin":false},"body":"Fixes #393.\r\n\r\n- If the user-specified server port is in use, we show an error message and don't start the server.\r\n- If the default admin port 8000 is in use, we try to find a free one.\r\n\r\nWe can be at a situation where we need to get two free ports. To avoid two consecutive `org.eclipse.jdt.launching.SocketUtil.findFreePort()` calls returning a same port, I created our own `findFreePort()` under the `.test.util` bundle.","created_at":"2016-11-02T21:05:40Z","updated_at":"2016-11-03T01:51:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72020220039b488b1ae173ccf8f4c16776a4554c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/938/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/938/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues/938/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/statuses/27bfce704fd5ad1fb6e127d62a5d3de23364d815","head":{"label":"GoogleCloudPlatform:check-server-ports","ref":"check-server-ports","sha":"27bfce704fd5ad1fb6e127d62a5d3de23364d815","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":53369484,"name":"google-cloud-eclipse","full_name":"GoogleCloudPlatform/google-cloud-eclipse","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse","description":"Google Cloud Platform plugin for Eclipse","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/deployments","created_at":"2016-03-08T00:30:03Z","updated_at":"2016-10-23T13:31:34Z","pushed_at":"2016-11-02T23:05:31Z","git_url":"git://github.com/GoogleCloudPlatform/google-cloud-eclipse.git","ssh_url":"git@github.com:GoogleCloudPlatform/google-cloud-eclipse.git","clone_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse.git","svn_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse","homepage":"","size":7184,"stargazers_count":14,"watchers_count":14,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":174,"forks":7,"open_issues":174,"watchers":14,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"b4a210ba856b72f9e31faa0b8687396df3adef6b","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":53369484,"name":"google-cloud-eclipse","full_name":"GoogleCloudPlatform/google-cloud-eclipse","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse","description":"Google Cloud Platform plugin for Eclipse","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/deployments","created_at":"2016-03-08T00:30:03Z","updated_at":"2016-10-23T13:31:34Z","pushed_at":"2016-11-02T23:05:31Z","git_url":"git://github.com/GoogleCloudPlatform/google-cloud-eclipse.git","ssh_url":"git@github.com:GoogleCloudPlatform/google-cloud-eclipse.git","clone_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse.git","svn_url":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse","homepage":"","size":7184,"stargazers_count":14,"watchers_count":14,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":174,"forks":7,"open_issues":174,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/938"},"html":{"href":"https://github.com/GoogleCloudPlatform/google-cloud-eclipse/pull/938"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues/938"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/issues/938/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/938/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/pulls/938/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-eclipse/statuses/27bfce704fd5ad1fb6e127d62a5d3de23364d815"}}}}
{"actor":{"display_login":"chanseokoh"}}