Error finding secondary location for issue
Details: squid:S1192
2823
253
2823
260
org.sonarlint.intellij.issue.IssueMatcher$NoMatchException: Start line number (2822) larger than lines in file: 2790
at org.sonarlint.intellij.issue.IssueMatcher.getIssueTextRange(IssueMatcher.java:79)
at org.sonarlint.intellij.issue.IssueMatcher.match(IssueMatcher.java:69)
at org.sonarlint.intellij.issue.IssueProcessor.transformFlows(IssueProcessor.java:191)
at org.sonarlint.intellij.issue.IssueProcessor.transformIssue(IssueProcessor.java:176)
at org.sonarlint.intellij.issue.IssueProcessor.transformIssues(IssueProcessor.java:159)
at org.sonarlint.intellij.issue.IssueProcessor.lambda$process$0(IssueProcessor.java:69)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:936)
at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57)
at org.sonarlint.intellij.issue.IssueProcessor.process(IssueProcessor.java:68)
at org.sonarlint.intellij.analysis.SonarLintTask.run(SonarLintTask.java:117)
at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$runTask$1(SonarLintJobManager.java:120)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$runTask$2(SonarLintJobManager.java:120)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
It did happen just once right after opening IDE.
I guess it has to relate to the fact that previous version of file was cached and in a very short moment IDE reread the file while the content was shorter or significantly different (git branch was changed externally).
Indeed this could happen if the SCM branch was switched externally to the IDE, and the file contents changed so that the line numbers do not match anymore between analysis and code annotation.
I created SLI-347 to make sure that such exceptions do not bubble up to the global level - external file changes do happen, at a very late time in some cases; and since code annotation happens asynchronously, we don’t have any guarantee that the file contents at annotation time is the same as at analysis time.