omayevskiy / sonar-intellij-plugin

4 stars 1 forks source link

Recurring IndexOutOfBoundsException while working in IDE #14

Open legrego opened 11 years ago

legrego commented 11 years ago

When working in a project which is using Sonar Connector, the IDEA Event Log will regularly throw this exception. In my latest attempt, I had one file open, which contains well over 1000 lines, so I am not sure what it is reading with a line count in the 400s.

Here are a couple different stack traces, which lead to the same exception:

Wrong line: 418. Available lines count: 413: Wrong line: 418. Available lines count: 413
java.lang.IndexOutOfBoundsException: Wrong line: 418. Available lines count: 413
    at com.intellij.openapi.editor.ex.util.SegmentArray.getSegmentStart(SegmentArray.java:181)
    at com.intellij.openapi.editor.impl.LineSet.getLineStart(LineSet.java:50)
    at com.intellij.openapi.editor.impl.DocumentImpl.getLineStartOffset(DocumentImpl.java:714)
    at org.mayevskiy.intellij.sonar.SonarLocalInspectionTool.getElementAtLine(SonarLocalInspectionTool.java:262)
    at org.mayevskiy.intellij.sonar.SonarLocalInspectionTool.checkFile(SonarLocalInspectionTool.java:191)
    at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:142)
    at com.intellij.psi.impl.source.PsiJavaFileBaseImpl.accept(PsiJavaFileBaseImpl.java:412)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.a(LocalInspectionsPass.java:412)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.access$300(LocalInspectionsPass.java:78)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$4.process(LocalInspectionsPass.java:388)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$4.process(LocalInspectionsPass.java:382)
    at com.intellij.concurrency.JobLauncherImpl$2$1.run(JobLauncherImpl.java:115)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:226)
    at com.intellij.concurrency.JobLauncherImpl$2.process(JobLauncherImpl.java:113)
    at com.intellij.concurrency.JobLauncherImpl$1.run(JobLauncherImpl.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at com.intellij.concurrency.PrioritizedFutureTask.access$101(PrioritizedFutureTask.java:31)
    at com.intellij.concurrency.PrioritizedFutureTask$1.run(PrioritizedFutureTask.java:70)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1182)
    at com.intellij.concurrency.PrioritizedFutureTask.run(PrioritizedFutureTask.java:97)
    at com.intellij.concurrency.JobImpl.scheduleAndWaitForResults(JobImpl.java:136)
    at com.intellij.concurrency.JobLauncherImpl.a(JobLauncherImpl.java:68)
    at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:110)
    at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgressAsync(JobLauncherImpl.java:131)
    at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgressAsync(JobLauncherImpl.java:37)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processElementsWithWordAsync(PsiSearchHelperImpl.java:148)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.c(PsiSearchHelperImpl.java:834)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.access$300(PsiSearchHelperImpl.java:55)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$17$1$1.process(PsiSearchHelperImpl.java:541)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$17$1$1.process(PsiSearchHelperImpl.java:538)
    at com.intellij.concurrency.Iterate.body(Iterate.java:23)
    at com.intellij.concurrency.DoWhile.getResult(DoWhile.java:32)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$17$1.onSuccess(PsiSearchHelperImpl.java:545)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$17$1.onSuccess(PsiSearchHelperImpl.java:531)
    at com.intellij.concurrency.AsyncFutureResultImpl$1.run(AsyncFutureResultImpl.java:42)
    at com.intellij.concurrency.SameThreadExecutor.execute(SameThreadExecutor.java:27)
    at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:149)
    at com.google.common.util.concurrent.ExecutionList.add(ExecutionList.java:105)
    at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:155)
    at com.intellij.concurrency.AsyncFutureResultImpl.addConsumer(AsyncFutureResultImpl.java:37)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$17.body(PsiSearchHelperImpl.java:530)
    at com.intellij.concurrency.DoWhile.getResult(DoWhile.java:32)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processRequestsAsync(PsiSearchHelperImpl.java:574)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processRequests(PsiSearchHelperImpl.java:510)
    at com.intellij.psi.search.SearchRequestQuery.processResults(SearchRequestQuery.java:29)
    at com.intellij.util.AbstractQuery.forEach(AbstractQuery.java:77)
    at com.intellij.util.MergeQuery.processSubQuery(MergeQuery.java:83)
    at com.intellij.util.MergeQuery.forEach(MergeQuery.java:56)
    at com.intellij.util.UniqueResultsQuery.process(UniqueResultsQuery.java:66)
    at com.intellij.util.UniqueResultsQuery.forEach(UniqueResultsQuery.java:56)
    at com.intellij.codeInspection.nullable.NullableStuffInspection.findAllConstructorInitializers(NullableStuffInspection.java:528)
    at com.intellij.codeInspection.dataFlow.DfaUtil.isNullableInitialized(DfaUtil.java:123)
    at com.intellij.codeInspection.dataFlow.value.DfaVariableValue.getInherentNullability(DfaVariableValue.java:162)
    at com.intellij.codeInspection.dataFlow.DfaVariableState.<init>(DfaVariableState.java:49)
    at com.intellij.codeInspection.dataFlow.DfaMemoryStateImpl.createVariableState(DfaMemoryStateImpl.java:768)
    at com.intellij.codeInspection.dataFlow.DfaMemoryStateImpl.getVariableState(DfaMemoryStateImpl.java:752)
    at com.intellij.codeInspection.dataFlow.DfaMemoryStateImpl.setVarValue(DfaMemoryStateImpl.java:260)
    at com.intellij.codeInspection.dataFlow.StandardInstructionVisitor.visitAssign(StandardInstructionVisitor.java:121)
    at com.intellij.codeInspection.dataFlow.instructions.AssignInstruction.accept(AssignInstruction.java:42)
    at com.intellij.codeInspection.dataFlow.DataFlowRunner.analyzeMethod(DataFlowRunner.java:155)
    at com.intellij.codeInspection.dataFlow.DataFlowInspection.a(DataFlowInspection.java:97)
    at com.intellij.codeInspection.dataFlow.DataFlowInspection.access$100(DataFlowInspection.java:63)
    at com.intellij.codeInspection.dataFlow.DataFlowInspection$1.visitField(DataFlowInspection.java:78)
    at com.intellij.psi.impl.source.PsiFieldImpl.accept(PsiFieldImpl.java:415)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.a(LocalInspectionsPass.java:412)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.access$300(LocalInspectionsPass.java:78)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$4.process(LocalInspectionsPass.java:388)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$4.process(LocalInspectionsPass.java:382)
    at com.intellij.concurrency.JobLauncherImpl$2$1.run(JobLauncherImpl.java:115)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:226)
    at com.intellij.concurrency.JobLauncherImpl$2.process(JobLauncherImpl.java:113)
    at com.intellij.concurrency.JobLauncherImpl$1.run(JobLauncherImpl.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at com.intellij.concurrency.PrioritizedFutureTask.access$101(PrioritizedFutureTask.java:31)
    at com.intellij.concurrency.PrioritizedFutureTask$1.run(PrioritizedFutureTask.java:70)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1182)
    at com.intellij.concurrency.PrioritizedFutureTask.run(PrioritizedFutureTask.java:97)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Wrong line: 418. Available lines count: 413: Wrong line: 418. Available lines count: 413
java.lang.IndexOutOfBoundsException: Wrong line: 418. Available lines count: 413
    at com.intellij.openapi.editor.ex.util.SegmentArray.getSegmentStart(SegmentArray.java:181)
    at com.intellij.openapi.editor.impl.LineSet.getLineStart(LineSet.java:50)
    at com.intellij.openapi.editor.impl.DocumentImpl.getLineStartOffset(DocumentImpl.java:714)
    at org.mayevskiy.intellij.sonar.SonarLocalInspectionTool.getElementAtLine(SonarLocalInspectionTool.java:262)
    at org.mayevskiy.intellij.sonar.SonarLocalInspectionTool.checkFile(SonarLocalInspectionTool.java:191)
    at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:142)
    at com.intellij.psi.impl.source.PsiJavaFileBaseImpl.accept(PsiJavaFileBaseImpl.java:412)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.a(LocalInspectionsPass.java:412)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.access$300(LocalInspectionsPass.java:78)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$4.process(LocalInspectionsPass.java:388)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$4.process(LocalInspectionsPass.java:382)
    at com.intellij.concurrency.JobLauncherImpl$2$1.run(JobLauncherImpl.java:115)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:226)
    at com.intellij.concurrency.JobLauncherImpl$2.process(JobLauncherImpl.java:113)
    at com.intellij.concurrency.JobLauncherImpl$1.run(JobLauncherImpl.java:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at com.intellij.concurrency.PrioritizedFutureTask.access$101(PrioritizedFutureTask.java:31)
    at com.intellij.concurrency.PrioritizedFutureTask$1.run(PrioritizedFutureTask.java:70)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1182)
    at com.intellij.concurrency.PrioritizedFutureTask.run(PrioritizedFutureTask.java:97)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)