Skip to content

Commit 57d903b

Browse files
committed
8255242: Bidi.requiresBidi has misleading exception message
Reviewed-by: bchristi
1 parent 60d0142 commit 57d903b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/java.base/share/classes/jdk/internal/icu/text/BidiBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4541,7 +4541,8 @@ public static boolean requiresBidi(char[] text,
45414541

45424542
if (0 > start || start > limit || limit > text.length) {
45434543
throw new IllegalArgumentException("Value start " + start +
4544-
" is out of range 0 to " + limit);
4544+
" is out of range 0 to " + limit + ", or limit " + limit +
4545+
" is beyond the text length " + text.length);
45454546
}
45464547

45474548
for (int i = start; i < limit; ++i) {

test/jdk/java/text/Bidi/BidiConformance.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 6850113 8032446
26+
* @bug 6850113 8032446 8255242
2727
* @summary confirm the behavior of new Bidi implementation. (Backward compatibility)
2828
* @modules java.desktop
2929
*/
@@ -1397,6 +1397,12 @@ private void testMethod_requiresBidi() {
13971397
" when limit is textLength+1(too large).");
13981398
}
13991399
catch (IllegalArgumentException e) {
1400+
if (!e.getMessage().equals(
1401+
"Value start 0 is out of range 0 to " + (textLength + 1) +
1402+
", or limit " + (textLength + 1) + " is beyond the text length " + textLength)) {
1403+
errorHandling("requiresBidi() should throw an IAE" +
1404+
" mentioning limit is beyond the text length. Message: " + e.getMessage());
1405+
}
14001406
}
14011407
catch (ArrayIndexOutOfBoundsException e) {
14021408
errorHandling("requiresBidi() should not throw an AIOoBE " +

0 commit comments

Comments
 (0)