{"action":"created","comment":{"url":"https://api.github.com/repos/apache/cloudstack/pulls/comments/36737719","id":36737719,"diff_hunk":"@@ -322,21 +306,11 @@ public String authenticate(final String command, final Map<String, Object[]> par\n                         if (_apiServer.verifyUser(userAccount.getId())) {\n                             LoginCmdResponse loginResponse = (LoginCmdResponse) _apiServer.loginUser(session, userAccount.getUsername(), userAccount.getUsername() + userAccount.getSource().toString(),\n                                     userAccount.getDomainId(), null, remoteAddress, params);\n-                            resp.addCookie(new Cookie(\"userid\", URLEncoder.encode(loginResponse.getUserId(), HttpUtils.UTF_8)));\n-                            resp.addCookie(new Cookie(\"domainid\", URLEncoder.encode(loginResponse.getDomainId(), HttpUtils.UTF_8)));\n-                            resp.addCookie(new Cookie(\"role\", URLEncoder.encode(loginResponse.getType(), HttpUtils.UTF_8)));\n-                            resp.addCookie(new Cookie(\"username\", URLEncoder.encode(loginResponse.getUsername(), HttpUtils.UTF_8)));\n-                            resp.addCookie(new Cookie(\"account\", URLEncoder.encode(loginResponse.getAccount(), HttpUtils.UTF_8)));\n-                            String timezone = loginResponse.getTimeZone();\n-                            if (timezone != null) {\n-                                resp.addCookie(new Cookie(\"timezone\", URLEncoder.encode(timezone, HttpUtils.UTF_8)));\n-                            }\n-                            resp.addCookie(new Cookie(\"userfullname\", URLEncoder.encode(loginResponse.getFirstName() + \" \" + loginResponse.getLastName(), HttpUtils.UTF_8).replace(\"+\", \"%20\")));\n-                            resp.addHeader(\"SET-COOKIE\", String.format(\"%s=%s;HttpOnly\", ApiConstants.SESSIONKEY, loginResponse.getSessionKey()));\n+                            SAMLUtils.setupSamlUserCookies(loginResponse, resp);\n                             resp.sendRedirect(SAML2AuthManager.SAMLCloudStackRedirectionUrl.value());\n                             return ApiResponseSerializer.toSerializedString(loginResponse, responseType);\n                         }\n-                    } catch (final CloudAuthenticationException ignored) {\n+                    } catch (final Exception ignored) {","path":"plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java","position":88,"original_position":88,"commit_id":"69f39d53316ba02b75516d0f8c37d6430027ee33","original_commit_id":"69f39d53316ba02b75516d0f8c37d6430027ee33","user":{"login":"jburwell","id":285646,"avatar_url":"https://avatars.githubusercontent.com/u/285646?v=3","gravatar_id":"","url":"https://api.github.com/users/jburwell","html_url":"https://github.com/jburwell","followers_url":"https://api.github.com/users/jburwell/followers","following_url":"https://api.github.com/users/jburwell/following{/other_user}","gists_url":"https://api.github.com/users/jburwell/gists{/gist_id}","starred_url":"https://api.github.com/users/jburwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jburwell/subscriptions","organizations_url":"https://api.github.com/users/jburwell/orgs","repos_url":"https://api.github.com/users/jburwell/repos","events_url":"https://api.github.com/users/jburwell/events{/privacy}","received_events_url":"https://api.github.com/users/jburwell/received_events","type":"User","site_admin":false},"body":"Java7 supports multi-catch[1] to avoid boilerplate error handling logic.  However, some code duplication would be preferable to an overly broad catch that swallows errors.  \n\nPersonally, I think all ignored exceptions should be logged to WARN.  Many times, a pattern of ignored exceptions is a symptom of pending and current systemic issue.  Having the information in the log as warning helps operators detect these types of errors and often avoid larger issues.\n\n[1]: https://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html <https://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html>\n> On Aug 11, 2015, at 1:26 AM, Rohit Yadav <notifications@github.com> wrote:\n> \n> In plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java <https://github.com/apache/cloudstack/pull/650#discussion_r36712694>:\n> \n> >                              resp.sendRedirect(SAML2AuthManager.SAMLCloudStackRedirectionUrl.value());\n> >                              return ApiResponseSerializer.toSerializedString(loginResponse, responseType);\n> >                          }\n> > -                    } catch (final CloudAuthenticationException ignored) {\n> > +                    } catch (final Exception ignored) {\n> @jburwell <https://github.com/jburwell> @DaanHoogland <https://github.com/DaanHoogland> catching pokemons allows to reduce redundant error handling code, in case of any auth or IO exception (as the plugin is conversing with the IDP server) an API authentication error is thrown at the bottom; not sure what could be the best way of handling this without duplicating code\n> \n> —\n> Reply to this email directly or view it on GitHub <https://github.com/apache/cloudstack/pull/650/files#r36712694>.\n> \n\n","created_at":"2015-08-11T12:13:43Z","updated_at":"2015-08-11T12:13:43Z","html_url":"https://github.com/apache/cloudstack/pull/650#discussion_r36737719","pull_request_url":"https://api.github.com/repos/apache/cloudstack/pulls/650","_links":{"self":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/comments/36737719"},"html":{"href":"https://github.com/apache/cloudstack/pull/650#discussion_r36737719"},"pull_request":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/650"}}},"pull_request":{"url":"https://api.github.com/repos/apache/cloudstack/pulls/650","id":41450162,"html_url":"https://github.com/apache/cloudstack/pull/650","diff_url":"https://github.com/apache/cloudstack/pull/650.diff","patch_url":"https://github.com/apache/cloudstack/pull/650.patch","issue_url":"https://api.github.com/repos/apache/cloudstack/issues/650","number":650,"state":"open","locked":false,"title":"APIServlet, AuthCmd, SAML fixes","user":{"login":"bhaisaab","id":95203,"avatar_url":"https://avatars.githubusercontent.com/u/95203?v=3","gravatar_id":"","url":"https://api.github.com/users/bhaisaab","html_url":"https://github.com/bhaisaab","followers_url":"https://api.github.com/users/bhaisaab/followers","following_url":"https://api.github.com/users/bhaisaab/following{/other_user}","gists_url":"https://api.github.com/users/bhaisaab/gists{/gist_id}","starred_url":"https://api.github.com/users/bhaisaab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhaisaab/subscriptions","organizations_url":"https://api.github.com/users/bhaisaab/orgs","repos_url":"https://api.github.com/users/bhaisaab/repos","events_url":"https://api.github.com/users/bhaisaab/events{/privacy}","received_events_url":"https://api.github.com/users/bhaisaab/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-03T09:42:27Z","updated_at":"2015-08-11T12:13:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b93710fb627c5c69226f68938dc4c193daf454d4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/cloudstack/pulls/650/commits","review_comments_url":"https://api.github.com/repos/apache/cloudstack/pulls/650/comments","review_comment_url":"https://api.github.com/repos/apache/cloudstack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/cloudstack/issues/650/comments","statuses_url":"https://api.github.com/repos/apache/cloudstack/statuses/69f39d53316ba02b75516d0f8c37d6430027ee33","head":{"label":"apache:4.5-samlfixes","ref":"4.5-samlfixes","sha":"69f39d53316ba02b75516d0f8c37d6430027ee33","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":9759448,"name":"cloudstack","full_name":"apache/cloudstack","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/cloudstack","description":"Mirror of Apache Cloudstack","fork":false,"url":"https://api.github.com/repos/apache/cloudstack","forks_url":"https://api.github.com/repos/apache/cloudstack/forks","keys_url":"https://api.github.com/repos/apache/cloudstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/cloudstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/cloudstack/teams","hooks_url":"https://api.github.com/repos/apache/cloudstack/hooks","issue_events_url":"https://api.github.com/repos/apache/cloudstack/issues/events{/number}","events_url":"https://api.github.com/repos/apache/cloudstack/events","assignees_url":"https://api.github.com/repos/apache/cloudstack/assignees{/user}","branches_url":"https://api.github.com/repos/apache/cloudstack/branches{/branch}","tags_url":"https://api.github.com/repos/apache/cloudstack/tags","blobs_url":"https://api.github.com/repos/apache/cloudstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/cloudstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/cloudstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/cloudstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/cloudstack/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/cloudstack/languages","stargazers_url":"https://api.github.com/repos/apache/cloudstack/stargazers","contributors_url":"https://api.github.com/repos/apache/cloudstack/contributors","subscribers_url":"https://api.github.com/repos/apache/cloudstack/subscribers","subscription_url":"https://api.github.com/repos/apache/cloudstack/subscription","commits_url":"https://api.github.com/repos/apache/cloudstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/cloudstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/cloudstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/cloudstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/cloudstack/contents/{+path}","compare_url":"https://api.github.com/repos/apache/cloudstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/cloudstack/merges","archive_url":"https://api.github.com/repos/apache/cloudstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/cloudstack/downloads","issues_url":"https://api.github.com/repos/apache/cloudstack/issues{/number}","pulls_url":"https://api.github.com/repos/apache/cloudstack/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/cloudstack/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/cloudstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/cloudstack/labels{/name}","releases_url":"https://api.github.com/repos/apache/cloudstack/releases{/id}","created_at":"2013-04-29T22:27:12Z","updated_at":"2015-08-10T07:01:56Z","pushed_at":"2015-08-11T11:24:30Z","git_url":"git://github.com/apache/cloudstack.git","ssh_url":"git@github.com:apache/cloudstack.git","clone_url":"https://github.com/apache/cloudstack.git","svn_url":"https://github.com/apache/cloudstack","homepage":null,"size":752036,"stargazers_count":269,"watchers_count":269,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":339,"mirror_url":"git://git.apache.org/cloudstack.git","open_issues_count":29,"forks":339,"open_issues":29,"watchers":269,"default_branch":"master"}},"base":{"label":"apache:4.5","ref":"4.5","sha":"17366f2b182aaa0943be451c79dac36fc08e221b","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":9759448,"name":"cloudstack","full_name":"apache/cloudstack","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/cloudstack","description":"Mirror of Apache Cloudstack","fork":false,"url":"https://api.github.com/repos/apache/cloudstack","forks_url":"https://api.github.com/repos/apache/cloudstack/forks","keys_url":"https://api.github.com/repos/apache/cloudstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/cloudstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/cloudstack/teams","hooks_url":"https://api.github.com/repos/apache/cloudstack/hooks","issue_events_url":"https://api.github.com/repos/apache/cloudstack/issues/events{/number}","events_url":"https://api.github.com/repos/apache/cloudstack/events","assignees_url":"https://api.github.com/repos/apache/cloudstack/assignees{/user}","branches_url":"https://api.github.com/repos/apache/cloudstack/branches{/branch}","tags_url":"https://api.github.com/repos/apache/cloudstack/tags","blobs_url":"https://api.github.com/repos/apache/cloudstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/cloudstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/cloudstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/cloudstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/cloudstack/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/cloudstack/languages","stargazers_url":"https://api.github.com/repos/apache/cloudstack/stargazers","contributors_url":"https://api.github.com/repos/apache/cloudstack/contributors","subscribers_url":"https://api.github.com/repos/apache/cloudstack/subscribers","subscription_url":"https://api.github.com/repos/apache/cloudstack/subscription","commits_url":"https://api.github.com/repos/apache/cloudstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/cloudstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/cloudstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/cloudstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/cloudstack/contents/{+path}","compare_url":"https://api.github.com/repos/apache/cloudstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/cloudstack/merges","archive_url":"https://api.github.com/repos/apache/cloudstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/cloudstack/downloads","issues_url":"https://api.github.com/repos/apache/cloudstack/issues{/number}","pulls_url":"https://api.github.com/repos/apache/cloudstack/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/cloudstack/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/cloudstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/cloudstack/labels{/name}","releases_url":"https://api.github.com/repos/apache/cloudstack/releases{/id}","created_at":"2013-04-29T22:27:12Z","updated_at":"2015-08-10T07:01:56Z","pushed_at":"2015-08-11T11:24:30Z","git_url":"git://github.com/apache/cloudstack.git","ssh_url":"git@github.com:apache/cloudstack.git","clone_url":"https://github.com/apache/cloudstack.git","svn_url":"https://github.com/apache/cloudstack","homepage":null,"size":752036,"stargazers_count":269,"watchers_count":269,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":339,"mirror_url":"git://git.apache.org/cloudstack.git","open_issues_count":29,"forks":339,"open_issues":29,"watchers":269,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/650"},"html":{"href":"https://github.com/apache/cloudstack/pull/650"},"issue":{"href":"https://api.github.com/repos/apache/cloudstack/issues/650"},"comments":{"href":"https://api.github.com/repos/apache/cloudstack/issues/650/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/650/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/650/commits"},"statuses":{"href":"https://api.github.com/repos/apache/cloudstack/statuses/69f39d53316ba02b75516d0f8c37d6430027ee33"}}}}