{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/che/pulls/comments/68069200","id":68069200,"diff_hunk":"@@ -18,42 +24,56 @@\n import javax.inject.Named;\n import javax.inject.Singleton;\n import java.io.IOException;\n-import java.net.HttpURLConnection;\n-import java.net.URL;\n+\n+import static com.google.common.base.Strings.isNullOrEmpty;\n+import static java.lang.Boolean.TRUE;\n \n /**\n  * Checks that docker registry is available.\n  *\n  * @author Yevhenii Voevodin\n+ * @author Alexander Andrienko\n  */\n @Singleton\n public class DockerRegistryChecker {\n \n     private static final Logger LOG = LoggerFactory.getLogger(DockerRegistryChecker.class);\n \n+    private final HttpJsonRequestFactory requestFactory;\n+    private final String                 registryUrl;\n+    private final Boolean                snapshotUseRegistry;\n+\n     @Inject\n-    @Named(\"docker.registry.auth.url\")\n-    private String registryUrl;\n+    public DockerRegistryChecker(HttpJsonRequestFactory requestFactory,\n+                                 @Nullable @Named(\"machine.docker.registry\") String registryUrl,\n+                                 @Nullable @Named(\"machine.docker.snapshot_use_registry\") Boolean snapshotUseRegistry) {\n+        this.requestFactory = requestFactory;\n+        this.registryUrl = registryUrl;\n+        this.snapshotUseRegistry = snapshotUseRegistry;\n+    }\n \n     /**\n      * Checks that registry is available and if it is not - logs warning message.\n      */\n+    @VisibleForTesting\n     @PostConstruct\n-    private void checkRegistryIsAvailable() throws IOException {\n-        LOG.info(\"Probing registry '{}'\", registryUrl);\n-        final HttpURLConnection conn = (HttpURLConnection) new URL(registryUrl).openConnection();\n-        conn.setConnectTimeout(30 * 1000);\n-        try {\n-            final int responseCode = conn.getResponseCode();\n-            LOG.info(\"Probe of registry '{}' succeed with HTTP response code '{}'\", registryUrl, responseCode);\n-        } catch (IOException ioEx) {\n-            LOG.warn(\"Docker registry \" + registryUrl + \" is not available, \" +\n-                     \"which means that you won't be able to save snapshots of your workspaces.\" +\n-                     \"\\nHow to configure registry?\" +\n-                     \"\\n\\tLocal registry  -> https://docs.docker.com/registry/\" +\n-                     \"\\n\\tRemote registry -> set up 'docker.registry.auth.*' properties\");\n-        } finally {\n-            conn.disconnect();\n+    void checkRegistryIsAvailable() {\n+        if (TRUE.equals(snapshotUseRegistry) && !isNullOrEmpty(registryUrl)) {\n+            String registryLink = \"http://\" + registryUrl;","path":"plugins/plugin-docker/che-plugin-docker-client/src/main/java/org/eclipse/che/plugin/docker/client/DockerRegistryChecker.java","position":71,"original_position":71,"commit_id":"c49c6713e1db8c453b84819c984135dbe6a8350f","original_commit_id":"c49c6713e1db8c453b84819c984135dbe6a8350f","user":{"login":"benoitf","id":436777,"avatar_url":"https://avatars.githubusercontent.com/u/436777?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitf","html_url":"https://github.com/benoitf","followers_url":"https://api.github.com/users/benoitf/followers","following_url":"https://api.github.com/users/benoitf/following{/other_user}","gists_url":"https://api.github.com/users/benoitf/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitf/subscriptions","organizations_url":"https://api.github.com/users/benoitf/orgs","repos_url":"https://api.github.com/users/benoitf/repos","events_url":"https://api.github.com/users/benoitf/events{/privacy}","received_events_url":"https://api.github.com/users/benoitf/received_events","type":"User","site_admin":false},"body":"it's strange to have http:// being concatenated with a variable named \"URL\" because URL is expected to already provide the protocol","created_at":"2016-06-22T14:59:52Z","updated_at":"2016-06-22T14:59:52Z","html_url":"https://github.com/eclipse/che/pull/1544#discussion_r68069200","pull_request_url":"https://api.github.com/repos/eclipse/che/pulls/1544","_links":{"self":{"href":"https://api.github.com/repos/eclipse/che/pulls/comments/68069200"},"html":{"href":"https://github.com/eclipse/che/pull/1544#discussion_r68069200"},"pull_request":{"href":"https://api.github.com/repos/eclipse/che/pulls/1544"}}},"pull_request":{"url":"https://api.github.com/repos/eclipse/che/pulls/1544","id":74738536,"html_url":"https://github.com/eclipse/che/pull/1544","diff_url":"https://github.com/eclipse/che/pull/1544.diff","patch_url":"https://github.com/eclipse/che/pull/1544.patch","issue_url":"https://api.github.com/repos/eclipse/che/issues/1544","number":1544,"state":"open","locked":false,"title":"[WIP] CHE-1312: Add ability to configure credentials for several docker private registries","user":{"login":"AndrienkoAleksandr","id":6873095,"avatar_url":"https://avatars.githubusercontent.com/u/6873095?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrienkoAleksandr","html_url":"https://github.com/AndrienkoAleksandr","followers_url":"https://api.github.com/users/AndrienkoAleksandr/followers","following_url":"https://api.github.com/users/AndrienkoAleksandr/following{/other_user}","gists_url":"https://api.github.com/users/AndrienkoAleksandr/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrienkoAleksandr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrienkoAleksandr/subscriptions","organizations_url":"https://api.github.com/users/AndrienkoAleksandr/orgs","repos_url":"https://api.github.com/users/AndrienkoAleksandr/repos","events_url":"https://api.github.com/users/AndrienkoAleksandr/events{/privacy}","received_events_url":"https://api.github.com/users/AndrienkoAleksandr/received_events","type":"User","site_admin":false},"body":"Add possibility configure credentials for several docker private registries in the che.properties.","created_at":"2016-06-22T07:53:04Z","updated_at":"2016-06-22T14:59:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba2a2c9e8e4547fc13f920bf3fc9a66cad0ccc33","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/eclipse/che/pulls/1544/commits","review_comments_url":"https://api.github.com/repos/eclipse/che/pulls/1544/comments","review_comment_url":"https://api.github.com/repos/eclipse/che/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/che/issues/1544/comments","statuses_url":"https://api.github.com/repos/eclipse/che/statuses/c49c6713e1db8c453b84819c984135dbe6a8350f","head":{"label":"eclipse:CHE-1312","ref":"CHE-1312","sha":"c49c6713e1db8c453b84819c984135dbe6a8350f","user":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":32935745,"name":"che","full_name":"eclipse/che","owner":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eclipse/che","description":"Eclipse Che: Next-generation Eclipse IDE.  Open source workspace server and cloud IDE.","fork":false,"url":"https://api.github.com/repos/eclipse/che","forks_url":"https://api.github.com/repos/eclipse/che/forks","keys_url":"https://api.github.com/repos/eclipse/che/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/che/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/che/teams","hooks_url":"https://api.github.com/repos/eclipse/che/hooks","issue_events_url":"https://api.github.com/repos/eclipse/che/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/che/events","assignees_url":"https://api.github.com/repos/eclipse/che/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/che/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/che/tags","blobs_url":"https://api.github.com/repos/eclipse/che/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/che/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/che/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/che/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/che/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/che/languages","stargazers_url":"https://api.github.com/repos/eclipse/che/stargazers","contributors_url":"https://api.github.com/repos/eclipse/che/contributors","subscribers_url":"https://api.github.com/repos/eclipse/che/subscribers","subscription_url":"https://api.github.com/repos/eclipse/che/subscription","commits_url":"https://api.github.com/repos/eclipse/che/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/che/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/che/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/che/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/che/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/che/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/che/merges","archive_url":"https://api.github.com/repos/eclipse/che/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/che/downloads","issues_url":"https://api.github.com/repos/eclipse/che/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/che/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/che/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/che/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/che/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/che/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/che/deployments","created_at":"2015-03-26T15:31:01Z","updated_at":"2016-06-21T22:28:55Z","pushed_at":"2016-06-22T14:55:24Z","git_url":"git://github.com/eclipse/che.git","ssh_url":"git@github.com:eclipse/che.git","clone_url":"https://github.com/eclipse/che.git","svn_url":"https://github.com/eclipse/che","homepage":"http://eclipse.org/che","size":38380,"stargazers_count":2908,"watchers_count":2908,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":443,"mirror_url":null,"open_issues_count":131,"forks":443,"open_issues":131,"watchers":2908,"default_branch":"master"}},"base":{"label":"eclipse:master","ref":"master","sha":"09ffd6294666e8cca8b099aeb32454e15ebba9d0","user":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":32935745,"name":"che","full_name":"eclipse/che","owner":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eclipse/che","description":"Eclipse Che: Next-generation Eclipse IDE.  Open source workspace server and cloud IDE.","fork":false,"url":"https://api.github.com/repos/eclipse/che","forks_url":"https://api.github.com/repos/eclipse/che/forks","keys_url":"https://api.github.com/repos/eclipse/che/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/che/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/che/teams","hooks_url":"https://api.github.com/repos/eclipse/che/hooks","issue_events_url":"https://api.github.com/repos/eclipse/che/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/che/events","assignees_url":"https://api.github.com/repos/eclipse/che/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/che/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/che/tags","blobs_url":"https://api.github.com/repos/eclipse/che/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/che/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/che/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/che/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/che/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/che/languages","stargazers_url":"https://api.github.com/repos/eclipse/che/stargazers","contributors_url":"https://api.github.com/repos/eclipse/che/contributors","subscribers_url":"https://api.github.com/repos/eclipse/che/subscribers","subscription_url":"https://api.github.com/repos/eclipse/che/subscription","commits_url":"https://api.github.com/repos/eclipse/che/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/che/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/che/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/che/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/che/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/che/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/che/merges","archive_url":"https://api.github.com/repos/eclipse/che/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/che/downloads","issues_url":"https://api.github.com/repos/eclipse/che/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/che/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/che/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/che/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/che/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/che/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/che/deployments","created_at":"2015-03-26T15:31:01Z","updated_at":"2016-06-21T22:28:55Z","pushed_at":"2016-06-22T14:55:24Z","git_url":"git://github.com/eclipse/che.git","ssh_url":"git@github.com:eclipse/che.git","clone_url":"https://github.com/eclipse/che.git","svn_url":"https://github.com/eclipse/che","homepage":"http://eclipse.org/che","size":38380,"stargazers_count":2908,"watchers_count":2908,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":443,"mirror_url":null,"open_issues_count":131,"forks":443,"open_issues":131,"watchers":2908,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/che/pulls/1544"},"html":{"href":"https://github.com/eclipse/che/pull/1544"},"issue":{"href":"https://api.github.com/repos/eclipse/che/issues/1544"},"comments":{"href":"https://api.github.com/repos/eclipse/che/issues/1544/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/che/pulls/1544/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/che/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/che/pulls/1544/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/che/statuses/c49c6713e1db8c453b84819c984135dbe6a8350f"}}}}
{"actor":{"display_login":"benoitf"}}