From 9e52c52e7d3ceba076021c752440d78797dad856 Mon Sep 17 00:00:00 2001 From: rupashka Date: Mon, 11 Apr 2011 19:55:15 +0400 Subject: [PATCH] 7030623: closed/javax/accessibility/4864610/bug4864610.java test fails just against jdk7 b134 Reviewed-by: peterz --- src/share/classes/javax/swing/text/Utilities.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/classes/javax/swing/text/Utilities.java b/src/share/classes/javax/swing/text/Utilities.java index e3ef4940d..c9c066e1f 100644 --- a/src/share/classes/javax/swing/text/Utilities.java +++ b/src/share/classes/javax/swing/text/Utilities.java @@ -395,10 +395,10 @@ public class Utilities { // the length of the string measured as a whole may differ from // the sum of individual character lengths, for example if // fractional metrics are enabled; and we must guard from this. - while (metrics.charsWidth(txt, txtOffset, offset + 1) > (x - x0)) { + while (offset > 0 && metrics.charsWidth(txt, txtOffset, offset) > (x - x0)) { offset--; } - return (offset < 0 ? 0 : offset); + return offset; } currX = nextX; } -- GitLab