-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StringIndexOutOfBoundsException
thrown when trying to perform Substring.Replacement
#3206
Comments
Thanks for the report, @rtyley! I think the following test is a reproduction of this issue: diff --git a/modules/core/src/test/scala/org/scalasteward/core/edit/RewriteTest.scala b/modules/core/src/test/scala/org/scalasteward/core/edit/RewriteTest.scala
index dc1f33d7..ad8d874c 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/edit/RewriteTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/edit/RewriteTest.scala
@@ -942,6 +942,15 @@ class RewriteTest extends FunSuite {
runApplyUpdate(update, original, expected)
}
+ // https://github.com/scala-steward-org/scala-steward/issues/3206
+ test("".only) {
+ val update = ("com.typesafe.play".g % "play".a % "2.9.0" %> "3.0.0").single
+ .copy(newerGroupId = Some("org.playframework".g), newerArtifactId = Some("play"))
+ val original = Map("build.sbt" -> """ "com.typesafe.play" %% "play" % "2.9.0" """)
+ val expected = Map("build.sbt" -> """ "org.playframework" %% "play" % "3.0.0" """)
+ runApplyUpdate(update, original, expected)
+ }
+
private def runApplyUpdate(
update: Update.Single,
files: Map[String, String], It looks suspicious that the |
This should be fixed by #3207. |
* Test the root cause of #3206 * Reproduce #3206 as rewrite test * Use correct start indices in ModulePositionScanner `ModulePositionScanner` currently reports wrong substring positions if an an artifactId is a proper substring of a groupId. With this change, regex capturing groups are used to get the correct start indices of substring positions of `ModulePositions`. * Reformat test
Thank you @fthomas ! I can see that this was released with v0.27.0, and running a Scala Steward job this morning with v0.27.0 and |
Good to hear that it is working now and thanks for reporting back! |
This looks a little like #3016 maybe, but that fix was merged for Scala Steward 0.24.0, and this run is running with Scala Steward v0.26.0.
The full exception in the logs is:
Note that exception says the substring has
begin 2326, end 2322
- which means that the requested end was 4 characters before the requested start.This seems to be failing consistently since I merged guardian/play-secret-rotation#411 at 12:02pm today:
This is the current build.sbt file in that project:
https://github.com/guardian/play-secret-rotation/blob/07068e712ab5aa8a41cc6354c34b1eadd58dd206/build.sbt
I'll probably have to exclude this particular project from our Scala Steward run until this is fixed, otherwise we get some bad side-effects from consistent failure.
The text was updated successfully, but these errors were encountered: