{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/http-remoting/pulls/comments/148374427","pull_request_review_id":73607261,"id":148374427,"diff_hunk":"@@ -73,7 +83,78 @@ private static String formatSingleAgent(UserAgent.Agent agent, Map<String, Strin\n         return formatted.toString();\n     }\n \n-    static boolean isValidLibraryName(String serviceName) {\n+\n+    /**\n+     * Parses the given string into a {@link UserAgent} or throws an {@link IllegalArgumentException} if the string does\n+     * not conform to the user agent syntax restrictions.\n+     */\n+    public static UserAgent parse(String userAgent) {\n+        return parseInternal(userAgent, false /* strict */);\n+    }\n+\n+    /** Like {@link #parse}, but returns only the syntactically correct agent parts (, possibly zero). */\n+    public static UserAgent tryParse(String userAgent) {\n+        return parseInternal(userAgent, true /* lenient*/);\n+    }\n+\n+    private static UserAgent parseInternal(String userAgent, boolean lenient) {\n+        ImmutableUserAgent.Builder builder = ImmutableUserAgent.builder();\n+        List<String> parts = COMMA_SPLITTER.splitToList(userAgent);\n+        checkArgument(!parts.isEmpty(), \"Empty user agents are not allowed\");","path":"http-clients/src/main/java/com/palantir/remoting3/clients/UserAgents.java","position":52,"original_position":52,"commit_id":"c84e6e2ad230843a8eba51910c993fad4caf39cf","original_commit_id":"c84e6e2ad230843a8eba51910c993fad4caf39cf","user":{"login":"markelliot","id":685891,"avatar_url":"https://avatars3.githubusercontent.com/u/685891?v=4","gravatar_id":"","url":"https://api.github.com/users/markelliot","html_url":"https://github.com/markelliot","followers_url":"https://api.github.com/users/markelliot/followers","following_url":"https://api.github.com/users/markelliot/following{/other_user}","gists_url":"https://api.github.com/users/markelliot/gists{/gist_id}","starred_url":"https://api.github.com/users/markelliot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markelliot/subscriptions","organizations_url":"https://api.github.com/users/markelliot/orgs","repos_url":"https://api.github.com/users/markelliot/repos","events_url":"https://api.github.com/users/markelliot/events{/privacy}","received_events_url":"https://api.github.com/users/markelliot/received_events","type":"User","site_admin":false},"body":"should this be conditionally lenient?","created_at":"2017-11-01T20:26:21Z","updated_at":"2017-11-01T20:26:21Z","html_url":"https://github.com/palantir/http-remoting/pull/598#discussion_r148374427","pull_request_url":"https://api.github.com/repos/palantir/http-remoting/pulls/598","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/palantir/http-remoting/pulls/comments/148374427"},"html":{"href":"https://github.com/palantir/http-remoting/pull/598#discussion_r148374427"},"pull_request":{"href":"https://api.github.com/repos/palantir/http-remoting/pulls/598"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/http-remoting/pulls/598","id":150110205,"html_url":"https://github.com/palantir/http-remoting/pull/598","diff_url":"https://github.com/palantir/http-remoting/pull/598.diff","patch_url":"https://github.com/palantir/http-remoting/pull/598.patch","issue_url":"https://api.github.com/repos/palantir/http-remoting/issues/598","number":598,"state":"open","locked":false,"title":"Add UserAgents#parse and UserAgents#tryParse","user":{"login":"uschi2000","id":6528449,"avatar_url":"https://avatars3.githubusercontent.com/u/6528449?v=4","gravatar_id":"","url":"https://api.github.com/users/uschi2000","html_url":"https://github.com/uschi2000","followers_url":"https://api.github.com/users/uschi2000/followers","following_url":"https://api.github.com/users/uschi2000/following{/other_user}","gists_url":"https://api.github.com/users/uschi2000/gists{/gist_id}","starred_url":"https://api.github.com/users/uschi2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uschi2000/subscriptions","organizations_url":"https://api.github.com/users/uschi2000/orgs","repos_url":"https://api.github.com/users/uschi2000/repos","events_url":"https://api.github.com/users/uschi2000/events{/privacy}","received_events_url":"https://api.github.com/users/uschi2000/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-01T18:24:02Z","updated_at":"2017-11-01T20:26:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31c6870d04b12dc25f0088311d392ac570508a2f","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/palantir/http-remoting/pulls/598/commits","review_comments_url":"https://api.github.com/repos/palantir/http-remoting/pulls/598/comments","review_comment_url":"https://api.github.com/repos/palantir/http-remoting/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/http-remoting/issues/598/comments","statuses_url":"https://api.github.com/repos/palantir/http-remoting/statuses/c84e6e2ad230843a8eba51910c993fad4caf39cf","head":{"label":"palantir:rfink/agent-parsing","ref":"rfink/agent-parsing","sha":"c84e6e2ad230843a8eba51910c993fad4caf39cf","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":43088077,"name":"http-remoting","full_name":"palantir/http-remoting","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/http-remoting","description":"a collection of useful utilities for use with HTTP remoting setups that use Feign as a client and Jersey as a server","fork":false,"url":"https://api.github.com/repos/palantir/http-remoting","forks_url":"https://api.github.com/repos/palantir/http-remoting/forks","keys_url":"https://api.github.com/repos/palantir/http-remoting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/http-remoting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/http-remoting/teams","hooks_url":"https://api.github.com/repos/palantir/http-remoting/hooks","issue_events_url":"https://api.github.com/repos/palantir/http-remoting/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/http-remoting/events","assignees_url":"https://api.github.com/repos/palantir/http-remoting/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/http-remoting/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/http-remoting/tags","blobs_url":"https://api.github.com/repos/palantir/http-remoting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/http-remoting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/http-remoting/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/http-remoting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/http-remoting/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/http-remoting/languages","stargazers_url":"https://api.github.com/repos/palantir/http-remoting/stargazers","contributors_url":"https://api.github.com/repos/palantir/http-remoting/contributors","subscribers_url":"https://api.github.com/repos/palantir/http-remoting/subscribers","subscription_url":"https://api.github.com/repos/palantir/http-remoting/subscription","commits_url":"https://api.github.com/repos/palantir/http-remoting/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/http-remoting/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/http-remoting/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/http-remoting/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/http-remoting/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/http-remoting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/http-remoting/merges","archive_url":"https://api.github.com/repos/palantir/http-remoting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/http-remoting/downloads","issues_url":"https://api.github.com/repos/palantir/http-remoting/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/http-remoting/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/http-remoting/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/http-remoting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/http-remoting/labels{/name}","releases_url":"https://api.github.com/repos/palantir/http-remoting/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/http-remoting/deployments","created_at":"2015-09-24T19:24:22Z","updated_at":"2017-10-27T02:50:18Z","pushed_at":"2017-11-01T19:55:21Z","git_url":"git://github.com/palantir/http-remoting.git","ssh_url":"git@github.com:palantir/http-remoting.git","clone_url":"https://github.com/palantir/http-remoting.git","svn_url":"https://github.com/palantir/http-remoting","homepage":"","size":2328,"stargazers_count":38,"watchers_count":38,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":60,"mirror_url":null,"archived":false,"open_issues_count":29,"forks":60,"open_issues":29,"watchers":38,"default_branch":"develop"}},"base":{"label":"palantir:develop","ref":"develop","sha":"74bea49dabb4ee6aaffb375c0ef9b23afa4fc07a","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":43088077,"name":"http-remoting","full_name":"palantir/http-remoting","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/http-remoting","description":"a collection of useful utilities for use with HTTP remoting setups that use Feign as a client and Jersey as a server","fork":false,"url":"https://api.github.com/repos/palantir/http-remoting","forks_url":"https://api.github.com/repos/palantir/http-remoting/forks","keys_url":"https://api.github.com/repos/palantir/http-remoting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/http-remoting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/http-remoting/teams","hooks_url":"https://api.github.com/repos/palantir/http-remoting/hooks","issue_events_url":"https://api.github.com/repos/palantir/http-remoting/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/http-remoting/events","assignees_url":"https://api.github.com/repos/palantir/http-remoting/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/http-remoting/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/http-remoting/tags","blobs_url":"https://api.github.com/repos/palantir/http-remoting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/http-remoting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/http-remoting/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/http-remoting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/http-remoting/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/http-remoting/languages","stargazers_url":"https://api.github.com/repos/palantir/http-remoting/stargazers","contributors_url":"https://api.github.com/repos/palantir/http-remoting/contributors","subscribers_url":"https://api.github.com/repos/palantir/http-remoting/subscribers","subscription_url":"https://api.github.com/repos/palantir/http-remoting/subscription","commits_url":"https://api.github.com/repos/palantir/http-remoting/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/http-remoting/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/http-remoting/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/http-remoting/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/http-remoting/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/http-remoting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/http-remoting/merges","archive_url":"https://api.github.com/repos/palantir/http-remoting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/http-remoting/downloads","issues_url":"https://api.github.com/repos/palantir/http-remoting/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/http-remoting/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/http-remoting/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/http-remoting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/http-remoting/labels{/name}","releases_url":"https://api.github.com/repos/palantir/http-remoting/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/http-remoting/deployments","created_at":"2015-09-24T19:24:22Z","updated_at":"2017-10-27T02:50:18Z","pushed_at":"2017-11-01T19:55:21Z","git_url":"git://github.com/palantir/http-remoting.git","ssh_url":"git@github.com:palantir/http-remoting.git","clone_url":"https://github.com/palantir/http-remoting.git","svn_url":"https://github.com/palantir/http-remoting","homepage":"","size":2328,"stargazers_count":38,"watchers_count":38,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":60,"mirror_url":null,"archived":false,"open_issues_count":29,"forks":60,"open_issues":29,"watchers":38,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/http-remoting/pulls/598"},"html":{"href":"https://github.com/palantir/http-remoting/pull/598"},"issue":{"href":"https://api.github.com/repos/palantir/http-remoting/issues/598"},"comments":{"href":"https://api.github.com/repos/palantir/http-remoting/issues/598/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/http-remoting/pulls/598/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/http-remoting/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/http-remoting/pulls/598/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/http-remoting/statuses/c84e6e2ad230843a8eba51910c993fad4caf39cf"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"markelliot"}}