Skip to content

Commit f8a746e

Browse files
committed
Fix test failure on Java 11
1 parent 2759a8a commit f8a746e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/run/t6827.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ object Test extends App {
88
it.copyToArray(arr, start, len)
99
"ok"
1010
} catch {
11+
case e: ArrayIndexOutOfBoundsException =>
12+
// Special-case printing this exception because the toString changed in Java 11
13+
val java11toString = """java.lang.ArrayIndexOutOfBoundsException: Index (-?\d+).*""".r
14+
15+
e.toString match {
16+
case java11toString(index) =>
17+
s"java.lang.ArrayIndexOutOfBoundsException: $index"
18+
case str =>
19+
str
20+
}
1121
case e: Exception => e.toString
1222
}
1323
println("%s: %s" format (label, status))

0 commit comments

Comments
 (0)