From 3cb52c1acc3a649c4422149d7f07ad9caa5ce593 Mon Sep 17 00:00:00 2001 From: Yiming Wang Date: Fri, 20 Dec 2013 09:58:03 +0000 Subject: [PATCH] 8030690: TEST_BUG java/nio/Buffer/Chars.java fails intermittently Reviewed-by: alanb --- jdk/test/java/nio/Buffer/Chars.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/test/java/nio/Buffer/Chars.java b/jdk/test/java/nio/Buffer/Chars.java index e91b6a73883..ef2df66ac14 100644 --- a/jdk/test/java/nio/Buffer/Chars.java +++ b/jdk/test/java/nio/Buffer/Chars.java @@ -51,8 +51,8 @@ public class Chars { */ static CharBuffer randomizeRange(CharBuffer cb) { int mid = cb.capacity() >>> 1; - int start = RAND.nextInt(mid); - int end = mid + RAND.nextInt(mid); + int start = RAND.nextInt(mid + 1); // from 0 to mid + int end = mid + RAND.nextInt(cb.capacity() - mid + 1); // from mid to capacity cb.position(start); cb.limit(end); return cb;