{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/comments/27656668","id":27656668,"diff_hunk":"@@ -88,13 +88,25 @@ public static String extractSonarProjectURLFromLogs(AbstractBuild<?, ?> build) t\n    * Iterate previous build of this project and return the last Sonar URL\n    */\n   public static String getLastSonarUrl(AbstractProject<?, ?> project) {\n-    RunList<? extends Run<?, ?>> builds = project.getBuilds();\n-    for (Run<?, ?> run : builds) {\n-      BuildSonarAction action = run.getAction(BuildSonarAction.class);\n-      if (action != null) {\n-        return action.getUrlName();\n-      }\n+    String url = getSonarUrlFromRun(project.getLastSuccessfulBuild());\n+    if (url != null) {\n+      return url;\n+    } else {\n+      return getSonarUrlFromRun(project.getLastUnstableBuild());\n+    }\n+  }\n+\n+  @Nullable","path":"src/main/java/hudson/plugins/sonar/utils/SonarUtils.java","position":29,"original_position":29,"commit_id":"33bd91f05ac780db1cabcf5c33441c011f7e76ef","original_commit_id":"33bd91f05ac780db1cabcf5c33441c011f7e76ef","user":{"login":"jglick","id":154109,"avatar_url":"https://avatars.githubusercontent.com/u/154109?v=3","gravatar_id":"","url":"https://api.github.com/users/jglick","html_url":"https://github.com/jglick","followers_url":"https://api.github.com/users/jglick/followers","following_url":"https://api.github.com/users/jglick/following{/other_user}","gists_url":"https://api.github.com/users/jglick/gists{/gist_id}","starred_url":"https://api.github.com/users/jglick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jglick/subscriptions","organizations_url":"https://api.github.com/users/jglick/orgs","repos_url":"https://api.github.com/users/jglick/repos","events_url":"https://api.github.com/users/jglick/events{/privacy}","received_events_url":"https://api.github.com/users/jglick/received_events","type":"User","site_admin":false},"body":"Use `@CheckForNull`. In general avoid `@Nullable` unless you have read its Javadoc carefully and really know what you are doing.","created_at":"2015-04-02T13:35:35Z","updated_at":"2015-04-02T13:35:35Z","html_url":"https://github.com/SonarSource/jenkins-sonar-plugin/pull/16#discussion_r27656668","pull_request_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/comments/27656668"},"html":{"href":"https://github.com/SonarSource/jenkins-sonar-plugin/pull/16#discussion_r27656668"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/16","id":32484267,"html_url":"https://github.com/SonarSource/jenkins-sonar-plugin/pull/16","diff_url":"https://github.com/SonarSource/jenkins-sonar-plugin/pull/16.diff","patch_url":"https://github.com/SonarSource/jenkins-sonar-plugin/pull/16.patch","issue_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/issues/16","number":16,"state":"open","locked":false,"title":"Prevent loading all builds to generate the url","user":{"login":"christ66","id":1302212,"avatar_url":"https://avatars.githubusercontent.com/u/1302212?v=3","gravatar_id":"","url":"https://api.github.com/users/christ66","html_url":"https://github.com/christ66","followers_url":"https://api.github.com/users/christ66/followers","following_url":"https://api.github.com/users/christ66/following{/other_user}","gists_url":"https://api.github.com/users/christ66/gists{/gist_id}","starred_url":"https://api.github.com/users/christ66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christ66/subscriptions","organizations_url":"https://api.github.com/users/christ66/orgs","repos_url":"https://api.github.com/users/christ66/repos","events_url":"https://api.github.com/users/christ66/events{/privacy}","received_events_url":"https://api.github.com/users/christ66/received_events","type":"User","site_admin":false},"body":"In order to generate the url at the root project page it could be an expensive operation because it will iterate all of the builds in order to find a url. If a project has a lot of failed/aborted builds which never sent information to sonar (and a `BuildSonarAction` was never created), or if the project enabled sonar for the first time would most likely encounter a performance issue and load every build until it found a sonar url. Instead this pull request changes it to generate the url from the last stable or unstable build.\r\n\r\n@reviewbybees","created_at":"2015-04-02T05:35:23Z","updated_at":"2015-04-02T13:35:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4325a5e5dc45f4db148a1295bb5129016cb17d4b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/16/commits","review_comments_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/16/comments","review_comment_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/issues/16/comments","statuses_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/statuses/33bd91f05ac780db1cabcf5c33441c011f7e76ef","head":{"label":"christ66:lazyloading","ref":"lazyloading","sha":"33bd91f05ac780db1cabcf5c33441c011f7e76ef","user":{"login":"christ66","id":1302212,"avatar_url":"https://avatars.githubusercontent.com/u/1302212?v=3","gravatar_id":"","url":"https://api.github.com/users/christ66","html_url":"https://github.com/christ66","followers_url":"https://api.github.com/users/christ66/followers","following_url":"https://api.github.com/users/christ66/following{/other_user}","gists_url":"https://api.github.com/users/christ66/gists{/gist_id}","starred_url":"https://api.github.com/users/christ66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christ66/subscriptions","organizations_url":"https://api.github.com/users/christ66/orgs","repos_url":"https://api.github.com/users/christ66/repos","events_url":"https://api.github.com/users/christ66/events{/privacy}","received_events_url":"https://api.github.com/users/christ66/received_events","type":"User","site_admin":false},"repo":{"id":32039953,"name":"jenkins-sonar-plugin","full_name":"christ66/jenkins-sonar-plugin","owner":{"login":"christ66","id":1302212,"avatar_url":"https://avatars.githubusercontent.com/u/1302212?v=3","gravatar_id":"","url":"https://api.github.com/users/christ66","html_url":"https://github.com/christ66","followers_url":"https://api.github.com/users/christ66/followers","following_url":"https://api.github.com/users/christ66/following{/other_user}","gists_url":"https://api.github.com/users/christ66/gists{/gist_id}","starred_url":"https://api.github.com/users/christ66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christ66/subscriptions","organizations_url":"https://api.github.com/users/christ66/orgs","repos_url":"https://api.github.com/users/christ66/repos","events_url":"https://api.github.com/users/christ66/events{/privacy}","received_events_url":"https://api.github.com/users/christ66/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christ66/jenkins-sonar-plugin","description":"Jenkins sonar plugin","fork":true,"url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin","forks_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/forks","keys_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/teams","hooks_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/hooks","issue_events_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/events","assignees_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/tags","blobs_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/languages","stargazers_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/stargazers","contributors_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/contributors","subscribers_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/subscribers","subscription_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/subscription","commits_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/merges","archive_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/downloads","issues_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/labels{/name}","releases_url":"https://api.github.com/repos/christ66/jenkins-sonar-plugin/releases{/id}","created_at":"2015-03-11T20:36:14Z","updated_at":"2015-03-30T12:23:06Z","pushed_at":"2015-04-02T05:28:06Z","git_url":"git://github.com/christ66/jenkins-sonar-plugin.git","ssh_url":"git@github.com:christ66/jenkins-sonar-plugin.git","clone_url":"https://github.com/christ66/jenkins-sonar-plugin.git","svn_url":"https://github.com/christ66/jenkins-sonar-plugin","homepage":"http://jenkins-ci.org/","size":869,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"SonarSource:master","ref":"master","sha":"6cd6cc29cfeeffd9fec7b04448a0b20ea4d83bc3","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":1381837,"name":"jenkins-sonar-plugin","full_name":"SonarSource/jenkins-sonar-plugin","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/jenkins-sonar-plugin","description":"Jenkins sonar plugin","fork":false,"url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin","forks_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/forks","keys_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/teams","hooks_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/events","assignees_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/tags","blobs_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/languages","stargazers_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/subscription","commits_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/merges","archive_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/downloads","issues_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/releases{/id}","created_at":"2011-02-18T09:54:38Z","updated_at":"2015-03-23T15:45:26Z","pushed_at":"2015-04-02T05:35:23Z","git_url":"git://github.com/SonarSource/jenkins-sonar-plugin.git","ssh_url":"git@github.com:SonarSource/jenkins-sonar-plugin.git","clone_url":"https://github.com/SonarSource/jenkins-sonar-plugin.git","svn_url":"https://github.com/SonarSource/jenkins-sonar-plugin","homepage":"http://jenkins-ci.org/","size":1455,"stargazers_count":48,"watchers_count":48,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":62,"mirror_url":null,"open_issues_count":5,"forks":62,"open_issues":5,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/16"},"html":{"href":"https://github.com/SonarSource/jenkins-sonar-plugin/pull/16"},"issue":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/issues/16"},"comments":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/jenkins-sonar-plugin/statuses/33bd91f05ac780db1cabcf5c33441c011f7e76ef"}}}}