Closed
Description
Description
An error java.lang.IllegalArgumentException: Invalid range specified: (60, 59);
occurs when generating SARIF reports for classes below.
To Reproduce
There is a class with a method that throws an InvocationTargetException
:
public class Main {
public int invokeDivide(int a, int b) throws
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException,
java.lang.IllegalAccessException {
Example example = new Example();
Method method = Example.class.getMethod("divide", int.class, int.class);
return (int) method.invoke(example, a, b);
}
}
And another class in another file:
public class Example {
public int divide(int a, int b) {
return a / b;
}
}
- Enable the checkbox "Display detected errors..." in the project settings
- Run test generation on the sample class above
Expected behavior
- Tests are generated
- There are correct links (to places with problems) on the Problem tabs
Actual behavior
java.lang.IllegalArgumentException: Invalid range specified: (60, 59);
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:231)
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:226)
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:222)
at com.intellij.openapi.util.TextRange.<init>(TextRange.java:41)
at com.intellij.openapi.util.TextRange.<init>(TextRange.java:30)
at org.utbot.intellij.plugin.inspection.UnitTestBotInspectionTool.getTextRange(UnitTestBotInspectionTool.kt:104)
at org.utbot.intellij.plugin.inspection.UnitTestBotInspectionTool.checkFile(UnitTestBotInspectionTool.kt:54)
at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$inspectFile$17(GlobalInspectionContextImpl.java:517)
at com.intellij.codeInspection.ex.InspectionEventsKt.reportWhenInspectionFinished(inspectionEvents.kt:17)
at com.intellij.codeInspection.ex.GlobalInspectionContextImpl.lambda$inspectFile$18(GlobalInspectionContextImpl.java:510)
...
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done