openrewrite / openrewrite/rewrite
Index out of bound in extensionless file
Open
Nobody has claimed this yet.
bug
groovy
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 571
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
What version of OpenRewrite are you using?
I am using Maven plugin v5.14.0
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
mvn -U -X org.openrewrite.maven:rewrite-maven-plugin:run -D rewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -D rewrite.activeRecipes=
org.openrewrite.java.migrate.UpgradeToJava21
What is the full stack trace of any errors you encountered?
Error while visiting scripts\jenkins-promote\dev-tst\Jenkinsfile_promoteToTST: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
java.base/java.util.Objects.checkIndex(Objects.java:385)
java.base/java.util.ArrayList.get(ArrayList.java:427)
org.openrewrite.java.JavaTemplate$Matcher.parameter(JavaTemplate.java:103)
org.openrewrite.java.migrate.net.URLConstructorsToURIRecipes$URLSingleArgumentConstructorRecipe$1.visitExpression(URLConstructorsToURIRecipes.java:68)
org.openrewrite.java.migrate.net.URLConstructorsToURIRecipes$URLSingleArgumentConstructorRecipe$1.visitExpression(URLConstructorsToURIRecipes.java:57)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Maven command against the extensionless Jenkinsfile path shown in the report. Read JavaTemplate.Matcher.parameter and URLConstructorsToURIRecipes.URLSingleArgumentConstructorRecipe around the reported lines to determine why an empty parameter list is indexed. Done means the recipe no longer raises IndexOutOfBoundsException for this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100