{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments/27120534","id":27120534,"diff_hunk":"@@ -19,119 +19,142 @@\n  */\n package org.sonar.server.computation.issue;\n \n-import com.google.common.base.Function;\n import org.apache.commons.lang.StringUtils;\n-import org.sonar.core.source.db.FileSourceDto;\n-import org.sonar.server.db.DbClient;\n-import org.sonar.server.source.db.FileSourceDb;\n+import org.sonar.batch.protocol.output.BatchReport;\n+import org.sonar.batch.protocol.output.BatchReportReader;\n+import org.sonar.server.source.index.SourceLineDoc;\n+import org.sonar.server.source.index.SourceLineIndex;\n \n import javax.annotation.CheckForNull;\n import javax.annotation.Nullable;\n \n-import java.io.InputStream;\n-import java.util.ArrayList;\n+import java.util.HashMap;\n import java.util.List;\n+import java.util.Map;\n \n /**\n- * Cache of the lines of the currently processed file. Only a single file\n+ * Cache of the lines of the currently processed file. Only a <strong>single</strong> file\n  * is kept in memory at a time. Moreover data is loaded on demand to avoid\n- * useless db trips.\n- * <p/>\n- * It assumes that db table FILE_SOURCES is up-to-date before using this\n- * cache.\n+ * useless db trips.<br />\n+ * It relies on:\n+ * <ul>\n+ *   <li>the SCM information sent in the report for modified files</li>\n+ *   <li>the source line index for non-modified files</li>\n+ * </ul>\n+ *","path":"server/sonar-server/src/main/java/org/sonar/server/computation/issue/SourceLinesCache.java","position":37,"original_position":37,"commit_id":"4f3f470000ab3e5da95c2132eb40106acab8b831","original_commit_id":"4f3f470000ab3e5da95c2132eb40106acab8b831","user":{"login":"julienlancelot","id":370769,"avatar_url":"https://avatars.githubusercontent.com/u/370769?v=3","gravatar_id":"","url":"https://api.github.com/users/julienlancelot","html_url":"https://github.com/julienlancelot","followers_url":"https://api.github.com/users/julienlancelot/followers","following_url":"https://api.github.com/users/julienlancelot/following{/other_user}","gists_url":"https://api.github.com/users/julienlancelot/gists{/gist_id}","starred_url":"https://api.github.com/users/julienlancelot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienlancelot/subscriptions","organizations_url":"https://api.github.com/users/julienlancelot/orgs","repos_url":"https://api.github.com/users/julienlancelot/repos","events_url":"https://api.github.com/users/julienlancelot/events{/privacy}","received_events_url":"https://api.github.com/users/julienlancelot/received_events","type":"User","site_admin":false},"body":":+1: ","created_at":"2015-03-25T13:43:17Z","updated_at":"2015-03-25T13:43:17Z","html_url":"https://github.com/SonarSource/sonarqube/pull/164#discussion_r27120534","pull_request_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/164","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments/27120534"},"html":{"href":"https://github.com/SonarSource/sonarqube/pull/164#discussion_r27120534"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/164"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/164","id":31623078,"html_url":"https://github.com/SonarSource/sonarqube/pull/164","diff_url":"https://github.com/SonarSource/sonarqube/pull/164.diff","patch_url":"https://github.com/SonarSource/sonarqube/pull/164.patch","issue_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/164","number":164,"state":"open","locked":false,"title":"compute SCM information - update auto-assign algorithm","user":{"login":"teryk","id":1247713,"avatar_url":"https://avatars.githubusercontent.com/u/1247713?v=3","gravatar_id":"","url":"https://api.github.com/users/teryk","html_url":"https://github.com/teryk","followers_url":"https://api.github.com/users/teryk/followers","following_url":"https://api.github.com/users/teryk/following{/other_user}","gists_url":"https://api.github.com/users/teryk/gists{/gist_id}","starred_url":"https://api.github.com/users/teryk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teryk/subscriptions","organizations_url":"https://api.github.com/users/teryk/orgs","repos_url":"https://api.github.com/users/teryk/repos","events_url":"https://api.github.com/users/teryk/events{/privacy}","received_events_url":"https://api.github.com/users/teryk/received_events","type":"User","site_admin":false},"body":null,"created_at":"2015-03-20T15:23:46Z","updated_at":"2015-03-25T13:43:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7dbf0e99e2544e33478669422717bd7b4ee6307a","assignee":{"login":"julienlancelot","id":370769,"avatar_url":"https://avatars.githubusercontent.com/u/370769?v=3","gravatar_id":"","url":"https://api.github.com/users/julienlancelot","html_url":"https://github.com/julienlancelot","followers_url":"https://api.github.com/users/julienlancelot/followers","following_url":"https://api.github.com/users/julienlancelot/following{/other_user}","gists_url":"https://api.github.com/users/julienlancelot/gists{/gist_id}","starred_url":"https://api.github.com/users/julienlancelot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienlancelot/subscriptions","organizations_url":"https://api.github.com/users/julienlancelot/orgs","repos_url":"https://api.github.com/users/julienlancelot/repos","events_url":"https://api.github.com/users/julienlancelot/events{/privacy}","received_events_url":"https://api.github.com/users/julienlancelot/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/164/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/164/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/164/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/4f3f470000ab3e5da95c2132eb40106acab8b831","head":{"label":"SonarSource:feature/server/scm_compute","ref":"feature/server/scm_compute","sha":"4f3f470000ab3e5da95c2132eb40106acab8b831","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":1222504,"name":"sonarqube","full_name":"SonarSource/sonarqube","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/sonarqube","description":"Put your technical debt under control","fork":false,"url":"https://api.github.com/repos/SonarSource/sonarqube","forks_url":"https://api.github.com/repos/SonarSource/sonarqube/forks","keys_url":"https://api.github.com/repos/SonarSource/sonarqube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonarqube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonarqube/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonarqube/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonarqube/events","assignees_url":"https://api.github.com/repos/SonarSource/sonarqube/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonarqube/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonarqube/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonarqube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonarqube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonarqube/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonarqube/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonarqube/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonarqube/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonarqube/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonarqube/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonarqube/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonarqube/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonarqube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonarqube/merges","archive_url":"https://api.github.com/repos/SonarSource/sonarqube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonarqube/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonarqube/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonarqube/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonarqube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonarqube/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonarqube/releases{/id}","created_at":"2011-01-05T11:05:17Z","updated_at":"2015-03-25T13:36:15Z","pushed_at":"2015-03-25T13:39:58Z","git_url":"git://github.com/SonarSource/sonarqube.git","ssh_url":"git@github.com:SonarSource/sonarqube.git","clone_url":"https://github.com/SonarSource/sonarqube.git","svn_url":"https://github.com/SonarSource/sonarqube","homepage":"http://www.sonarqube.org","size":513614,"stargazers_count":554,"watchers_count":554,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":303,"mirror_url":null,"open_issues_count":10,"forks":303,"open_issues":10,"watchers":554,"default_branch":"master"}},"base":{"label":"SonarSource:master","ref":"master","sha":"75c38e1b5ec90680cf5556b3f3545ae8f218b5ce","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":1222504,"name":"sonarqube","full_name":"SonarSource/sonarqube","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/sonarqube","description":"Put your technical debt under control","fork":false,"url":"https://api.github.com/repos/SonarSource/sonarqube","forks_url":"https://api.github.com/repos/SonarSource/sonarqube/forks","keys_url":"https://api.github.com/repos/SonarSource/sonarqube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonarqube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonarqube/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonarqube/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonarqube/events","assignees_url":"https://api.github.com/repos/SonarSource/sonarqube/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonarqube/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonarqube/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonarqube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonarqube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonarqube/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonarqube/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonarqube/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonarqube/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonarqube/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonarqube/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonarqube/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonarqube/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonarqube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonarqube/merges","archive_url":"https://api.github.com/repos/SonarSource/sonarqube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonarqube/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonarqube/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonarqube/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonarqube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonarqube/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonarqube/releases{/id}","created_at":"2011-01-05T11:05:17Z","updated_at":"2015-03-25T13:36:15Z","pushed_at":"2015-03-25T13:39:58Z","git_url":"git://github.com/SonarSource/sonarqube.git","ssh_url":"git@github.com:SonarSource/sonarqube.git","clone_url":"https://github.com/SonarSource/sonarqube.git","svn_url":"https://github.com/SonarSource/sonarqube","homepage":"http://www.sonarqube.org","size":513614,"stargazers_count":554,"watchers_count":554,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":303,"mirror_url":null,"open_issues_count":10,"forks":303,"open_issues":10,"watchers":554,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/164"},"html":{"href":"https://github.com/SonarSource/sonarqube/pull/164"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonarqube/issues/164"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonarqube/issues/164/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/164/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/164/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonarqube/statuses/4f3f470000ab3e5da95c2132eb40106acab8b831"}}}}