Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

IndexOutOfBoundsException from utbot inspection tool on Spring Unit tests generation #2320

Open
Labels
comp-sarifIssue is related to SARIF report or Problems tab comp-springIssue is related to Spring projects support ctg-bugIssue is a bug spec-flakyReproducing scenario is not clear spec-internalInternal issue
@alisevych

Description

Description

IndexOutOfBoundsException is thrown from UnitTestBotInspectionTool when Spring Unit tests generation is run on PetController class in spring-petclinic project.

To Reproduce

  1. Install UnitTestBot plugin built from main in IntelliJ IDEA Ultimate 2023.1
  2. Open spring-petclinic project
  3. Generate tests for PetController:
    select PetClinicApplication as Spring configuration and Unit tests

Expected behavior

Wrong lines detected should be in available lines count.

Actual behavior

IndexOutOfBoundsException: Wrong line: 193. Available lines count: 121 is thrown in IDE.

Screenshots, logs

In file: D:/JavaProjects/spring/spring-petclinic/src/main/java/org/springframework/samples/petclinic/owner/PetController.java
java.lang.IndexOutOfBoundsException: Wrong line: 193. Available lines count: 121
	at com.intellij.openapi.editor.impl.LineSet.checkLineIndex(LineSet.java:200)
	at com.intellij.openapi.editor.impl.LineSet.getLineStart(LineSet.java:181)
	at com.intellij.openapi.editor.impl.DocumentImpl.getLineStartOffset(DocumentImpl.java:1027)
	at org.utbot.intellij.plugin.inspection.UnitTestBotInspectionTool.getTextRange(UnitTestBotInspectionTool.kt:121)
	at org.utbot.intellij.plugin.inspection.UnitTestBotInspectionTool.checkFile(UnitTestBotInspectionTool.kt:73)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$inspectFile16ドル(GlobalInspectionContextImpl.java:512)
	at com.intellij.codeInspection.ex.InspectionEventsKt.reportWhenInspectionFinished(inspectionEvents.kt:18)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$inspectFile17ドル(GlobalInspectionContextImpl.java:505)
	at com.intellij.concurrency.JobLauncherImpl.lambda$processImmediatelyIfTooFew2ドル(JobLauncherImpl.java:137)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress13ドル(CoreProgressManager.java:604)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.concurrency.JobLauncherImpl.lambda$processImmediatelyIfTooFew3ドル(JobLauncherImpl.java:133)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:865)
	at com.intellij.concurrency.JobLauncherImpl.processImmediatelyIfTooFew(JobLauncherImpl.java:144)
	at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:44)
	at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:51)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$inspectFile18ドル(GlobalInspectionContextImpl.java:501)
	at com.intellij.codeInspection.ex.InspectionProfileWrapper.runWithCustomInspectionWrapper(InspectionProfileWrapper.java:89)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.inspectFile(GlobalInspectionContextImpl.java:481)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$runTools6ドル(GlobalInspectionContextImpl.java:341)
	at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode0ドル(DumbService.java:112)
	at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode1ドル(DumbService.java:156)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:891)
	at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:69)
	at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:149)
	at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:112)
	at com.intellij.openapi.project.DumbService.tryRunReadActionInSmartMode(DumbService.java:129)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$runTools12ドル(GlobalInspectionContextImpl.java:326)
	at com.intellij.concurrency.JobLauncherImpl1ドルMyProcessQueueTask.lambda$call0ドル(JobLauncherImpl.java:299)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress13ドル(CoreProgressManager.java:604)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.concurrency.JobLauncherImpl1ドルMyProcessQueueTask.call(JobLauncherImpl.java:284)
	at com.intellij.concurrency.JobLauncherImpl.processQueue(JobLauncherImpl.java:352)
	at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.runTools(GlobalInspectionContextImpl.java:383)
	at com.intellij.codeInspection.ex.GlobalInspectionContextBase.lambda$performInspectionsWithProgress2ドル(GlobalInspectionContextBase.java:272)
	at com.intellij.psi.impl.PsiManagerImpl.runInBatchFilesMode(PsiManagerImpl.java:457)
	at com.intellij.codeInspection.ex.GlobalInspectionContextBase.lambda$performInspectionsWithProgress3ドル(GlobalInspectionContextBase.java:266)
	at com.intellij.codeInspection.reference.RefManagerImpl.runInsideInspectionReadAction(RefManagerImpl.java:507)
	at com.intellij.codeInspection.ex.GlobalInspectionContextBase.performInspectionsWithProgress(GlobalInspectionContextBase.java:265)
	at com.intellij.codeInspection.ex.GlobalInspectionContextBase2ドル.run(GlobalInspectionContextBase.java:226)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously6ドル(CoreProgressManager.java:480)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit3ドル(ProgressRunner.java:252)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess2ドル(CoreProgressManager.java:186)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress13ドル(CoreProgressManager.java:604)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit4ドル(ProgressRunner.java:252)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory1ドル1ドル.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory1ドル1ドル.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory1ドル.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)

Environment

IntelliJ IDEA version - 2023年1月2日 Ultimate
Project - spring-petclinic
JDK -

Additional context

Didn't reproduce. Sarif report doesn't match, probably it was not saved because of exception in inspection tool...

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp-sarifIssue is related to SARIF report or Problems tab comp-springIssue is related to Spring projects support ctg-bugIssue is a bug spec-flakyReproducing scenario is not clear spec-internalInternal issue

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /