Skip to content
Permalink
Browse files
8255242: Bidi.requiresBidi has misleading exception message
Reviewed-by: bchristi
  • Loading branch information
naotoj committed Oct 25, 2020
1 parent 60d0142 commit 57d903bdd982e09c9348f4b7608be93b862d8716
Showing with 10 additions and 3 deletions.
  1. +2 −1 src/java.base/share/classes/jdk/internal/icu/text/BidiBase.java
  2. +8 −2 test/jdk/java/text/Bidi/BidiConformance.java
@@ -4541,7 +4541,8 @@ public static boolean requiresBidi(char[] text,

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

for (int i = start; i < limit; ++i) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@

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

1 comment on commit 57d903b

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on 57d903b Oct 25, 2020

Please sign in to comment.