{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-commons/pulls/comments/37962926","id":37962926,"diff_hunk":"@@ -444,30 +447,34 @@ private boolean validateTopicName(String topicName) {\n     @Override\n     public String[] getBackendRoles() throws EventBrokerException {\n         UserRealm userRealm = CarbonContext.getThreadLocalCarbonContext().getUserRealm();\n+        String[] cleanedRoles = new String[0];\n         try {\n             String adminRole =\n                     EventBrokerHolder.getInstance().getRealmService().\n                             getBootstrapRealmConfiguration().getAdminRoleName();\n             String[] allRoles = userRealm.getUserStoreManager().getRoleNames();\n-            // check if more roles available than admin role and anonymous role\n+            // check if there is only admin role exists.\n             if (allRoles != null && allRoles.length > 1) {\n-                String[] rolesExceptAdminRole = new String[allRoles.length - 1];\n-                int index = 0;\n-                for (String role : allRoles) {\n-                    if (!(role.equals(adminRole) ||\n-                          CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME.equals(role))) {\n-                        rolesExceptAdminRole[index] = role;\n-                        index++;\n+                // check if more roles available than admin role and anonymous role\n+                List<String> allRolesArrayList = new ArrayList<>();\n+                Collections.addAll(allRolesArrayList, allRoles);\n+\n+                Iterator<String> it = allRolesArrayList.iterator();\n+                while (it.hasNext()) {\n+                    String nextRoles = it.next();","path":"components/event/org.wso2.carbon.event.core/src/main/java/org/wso2/carbon/event/core/internal/topic/registry/RegistryTopicManager.java","position":40,"original_position":40,"commit_id":"c66d3fcbf94cf49c6c8e062f0cb9c08aae75cb6b","original_commit_id":"c66d3fcbf94cf49c6c8e062f0cb9c08aae75cb6b","user":{"login":"callkalpa","id":504756,"avatar_url":"https://avatars.githubusercontent.com/u/504756?v=3","gravatar_id":"","url":"https://api.github.com/users/callkalpa","html_url":"https://github.com/callkalpa","followers_url":"https://api.github.com/users/callkalpa/followers","following_url":"https://api.github.com/users/callkalpa/following{/other_user}","gists_url":"https://api.github.com/users/callkalpa/gists{/gist_id}","starred_url":"https://api.github.com/users/callkalpa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/callkalpa/subscriptions","organizations_url":"https://api.github.com/users/callkalpa/orgs","repos_url":"https://api.github.com/users/callkalpa/repos","events_url":"https://api.github.com/users/callkalpa/events{/privacy}","received_events_url":"https://api.github.com/users/callkalpa/received_events","type":"User","site_admin":false},"body":"It seems it.next() returns a role, why the variable name a nextRoles? ","created_at":"2015-08-26T09:35:43Z","updated_at":"2015-08-26T09:35:43Z","html_url":"https://github.com/wso2/carbon-commons/pull/139#discussion_r37962926","pull_request_url":"https://api.github.com/repos/wso2/carbon-commons/pulls/139","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-commons/pulls/comments/37962926"},"html":{"href":"https://github.com/wso2/carbon-commons/pull/139#discussion_r37962926"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-commons/pulls/139"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-commons/pulls/139","id":43376648,"html_url":"https://github.com/wso2/carbon-commons/pull/139","diff_url":"https://github.com/wso2/carbon-commons/pull/139.diff","patch_url":"https://github.com/wso2/carbon-commons/pull/139.patch","issue_url":"https://api.github.com/repos/wso2/carbon-commons/issues/139","number":139,"state":"open","locked":false,"title":"[MB-1201] Modified method in getting user roles when adding a topic in event component through UI","user":{"login":"hemikak","id":4398820,"avatar_url":"https://avatars.githubusercontent.com/u/4398820?v=3","gravatar_id":"","url":"https://api.github.com/users/hemikak","html_url":"https://github.com/hemikak","followers_url":"https://api.github.com/users/hemikak/followers","following_url":"https://api.github.com/users/hemikak/following{/other_user}","gists_url":"https://api.github.com/users/hemikak/gists{/gist_id}","starred_url":"https://api.github.com/users/hemikak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hemikak/subscriptions","organizations_url":"https://api.github.com/users/hemikak/orgs","repos_url":"https://api.github.com/users/hemikak/repos","events_url":"https://api.github.com/users/hemikak/events{/privacy}","received_events_url":"https://api.github.com/users/hemikak/received_events","type":"User","site_admin":false},"body":"JIRA - https://wso2.org/jira/browse/MB-1201\r\n\r\nThere was an issue of using a String array for getting the user roles and removing admin and anonymous users.\r\n\r\nTherefore now using an Array list and iterator to remove those roles.","created_at":"2015-08-26T08:34:02Z","updated_at":"2015-08-26T09:35:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22fcc99c0ea3b4b0c86519361069a9eca5b94192","assignee":{"login":"callkalpa","id":504756,"avatar_url":"https://avatars.githubusercontent.com/u/504756?v=3","gravatar_id":"","url":"https://api.github.com/users/callkalpa","html_url":"https://github.com/callkalpa","followers_url":"https://api.github.com/users/callkalpa/followers","following_url":"https://api.github.com/users/callkalpa/following{/other_user}","gists_url":"https://api.github.com/users/callkalpa/gists{/gist_id}","starred_url":"https://api.github.com/users/callkalpa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/callkalpa/subscriptions","organizations_url":"https://api.github.com/users/callkalpa/orgs","repos_url":"https://api.github.com/users/callkalpa/repos","events_url":"https://api.github.com/users/callkalpa/events{/privacy}","received_events_url":"https://api.github.com/users/callkalpa/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-commons/pulls/139/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-commons/pulls/139/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-commons/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-commons/issues/139/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-commons/statuses/c66d3fcbf94cf49c6c8e062f0cb9c08aae75cb6b","head":{"label":"hemikak:topic-getuserroles","ref":"topic-getuserroles","sha":"c66d3fcbf94cf49c6c8e062f0cb9c08aae75cb6b","user":{"login":"hemikak","id":4398820,"avatar_url":"https://avatars.githubusercontent.com/u/4398820?v=3","gravatar_id":"","url":"https://api.github.com/users/hemikak","html_url":"https://github.com/hemikak","followers_url":"https://api.github.com/users/hemikak/followers","following_url":"https://api.github.com/users/hemikak/following{/other_user}","gists_url":"https://api.github.com/users/hemikak/gists{/gist_id}","starred_url":"https://api.github.com/users/hemikak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hemikak/subscriptions","organizations_url":"https://api.github.com/users/hemikak/orgs","repos_url":"https://api.github.com/users/hemikak/repos","events_url":"https://api.github.com/users/hemikak/events{/privacy}","received_events_url":"https://api.github.com/users/hemikak/received_events","type":"User","site_admin":false},"repo":{"id":30518789,"name":"carbon-commons","full_name":"hemikak/carbon-commons","owner":{"login":"hemikak","id":4398820,"avatar_url":"https://avatars.githubusercontent.com/u/4398820?v=3","gravatar_id":"","url":"https://api.github.com/users/hemikak","html_url":"https://github.com/hemikak","followers_url":"https://api.github.com/users/hemikak/followers","following_url":"https://api.github.com/users/hemikak/following{/other_user}","gists_url":"https://api.github.com/users/hemikak/gists{/gist_id}","starred_url":"https://api.github.com/users/hemikak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hemikak/subscriptions","organizations_url":"https://api.github.com/users/hemikak/orgs","repos_url":"https://api.github.com/users/hemikak/repos","events_url":"https://api.github.com/users/hemikak/events{/privacy}","received_events_url":"https://api.github.com/users/hemikak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hemikak/carbon-commons","description":"","fork":true,"url":"https://api.github.com/repos/hemikak/carbon-commons","forks_url":"https://api.github.com/repos/hemikak/carbon-commons/forks","keys_url":"https://api.github.com/repos/hemikak/carbon-commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hemikak/carbon-commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hemikak/carbon-commons/teams","hooks_url":"https://api.github.com/repos/hemikak/carbon-commons/hooks","issue_events_url":"https://api.github.com/repos/hemikak/carbon-commons/issues/events{/number}","events_url":"https://api.github.com/repos/hemikak/carbon-commons/events","assignees_url":"https://api.github.com/repos/hemikak/carbon-commons/assignees{/user}","branches_url":"https://api.github.com/repos/hemikak/carbon-commons/branches{/branch}","tags_url":"https://api.github.com/repos/hemikak/carbon-commons/tags","blobs_url":"https://api.github.com/repos/hemikak/carbon-commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hemikak/carbon-commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hemikak/carbon-commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/hemikak/carbon-commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hemikak/carbon-commons/statuses/{sha}","languages_url":"https://api.github.com/repos/hemikak/carbon-commons/languages","stargazers_url":"https://api.github.com/repos/hemikak/carbon-commons/stargazers","contributors_url":"https://api.github.com/repos/hemikak/carbon-commons/contributors","subscribers_url":"https://api.github.com/repos/hemikak/carbon-commons/subscribers","subscription_url":"https://api.github.com/repos/hemikak/carbon-commons/subscription","commits_url":"https://api.github.com/repos/hemikak/carbon-commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/hemikak/carbon-commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/hemikak/carbon-commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/hemikak/carbon-commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/hemikak/carbon-commons/contents/{+path}","compare_url":"https://api.github.com/repos/hemikak/carbon-commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hemikak/carbon-commons/merges","archive_url":"https://api.github.com/repos/hemikak/carbon-commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hemikak/carbon-commons/downloads","issues_url":"https://api.github.com/repos/hemikak/carbon-commons/issues{/number}","pulls_url":"https://api.github.com/repos/hemikak/carbon-commons/pulls{/number}","milestones_url":"https://api.github.com/repos/hemikak/carbon-commons/milestones{/number}","notifications_url":"https://api.github.com/repos/hemikak/carbon-commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hemikak/carbon-commons/labels{/name}","releases_url":"https://api.github.com/repos/hemikak/carbon-commons/releases{/id}","created_at":"2015-02-09T04:36:23Z","updated_at":"2015-02-09T04:36:29Z","pushed_at":"2015-08-26T08:31:24Z","git_url":"git://github.com/hemikak/carbon-commons.git","ssh_url":"git@github.com:hemikak/carbon-commons.git","clone_url":"https://github.com/hemikak/carbon-commons.git","svn_url":"https://github.com/hemikak/carbon-commons","homepage":null,"size":13194,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"wso2:master","ref":"master","sha":"de5dfafaaf3b2a3586e309b3a3ac272289ea9ae3","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"repo":{"id":16501680,"name":"carbon-commons","full_name":"wso2/carbon-commons","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wso2/carbon-commons","description":"","fork":false,"url":"https://api.github.com/repos/wso2/carbon-commons","forks_url":"https://api.github.com/repos/wso2/carbon-commons/forks","keys_url":"https://api.github.com/repos/wso2/carbon-commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-commons/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-commons/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-commons/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-commons/events","assignees_url":"https://api.github.com/repos/wso2/carbon-commons/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-commons/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-commons/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-commons/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-commons/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-commons/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-commons/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-commons/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-commons/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-commons/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-commons/merges","archive_url":"https://api.github.com/repos/wso2/carbon-commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-commons/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-commons/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-commons/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-commons/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-commons/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-commons/releases{/id}","created_at":"2014-02-04T03:53:48Z","updated_at":"2015-07-23T16:08:50Z","pushed_at":"2015-08-26T09:15:47Z","git_url":"git://github.com/wso2/carbon-commons.git","ssh_url":"git@github.com:wso2/carbon-commons.git","clone_url":"https://github.com/wso2/carbon-commons.git","svn_url":"https://github.com/wso2/carbon-commons","homepage":null,"size":15838,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":89,"mirror_url":null,"open_issues_count":6,"forks":89,"open_issues":6,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-commons/pulls/139"},"html":{"href":"https://github.com/wso2/carbon-commons/pull/139"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-commons/issues/139"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-commons/issues/139/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-commons/pulls/139/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-commons/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-commons/pulls/139/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-commons/statuses/c66d3fcbf94cf49c6c8e062f0cb9c08aae75cb6b"}}}}