Skip to content

StringIndexOutOfBoundsException #169

@xterao

Description

@xterao

Stack Trace:

java.lang.StringIndexOutOfBoundsException: Range [73, -1) out of bounds for length 189
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
	at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4865)
	at java.base/java.lang.String.substring(String.java:2834)
	at org.domaframework.doma.intellij.common.FileTypeCheckKt.searchDaoFile(FileTypeCheck.kt:96)
	at org.domaframework.doma.intellij.common.dao.DaoMethodUtilKt.findDaoFile(DaoMethodUtil.kt:136)
	at org.domaframework.doma.intellij.common.dao.DaoMethodUtilKt.findDaoMethod(DaoMethodUtil.kt:62)
	at org.domaframework.doma.intellij.common.dao.DaoMethodUtilKt.findDaoMethod$default(DaoMethodUtil.kt:46)

IntelliJ 2025.1.1.1

This scenario isn’t normally expected, but an error is thrown if /src/main can’t be found in the original file path. Add a guard to return early whenever indexOf() returns –1 or yields a value smaller than the project root path length.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions