-
Bug
-
Resolution: Fixed
-
P3
-
9, 10
-
None
-
b14
As discovered by automated code analysis, BasicProgressBarUI.java#getStringPlacement calls Math.round on int input, which is never a good idea, either a useless no-op or a loss of precision for values near Integer.MAX_VALUE. Maybe divide by 2.0 instead of 2?
return new Point(x + Math.round(width/2 - stringWidth/2),
y + ((height +
fontSizer.getAscent() -
fontSizer.getLeading() -
fontSizer.getDescent()) / 2));
} else { // VERTICAL
return new Point(x + ((width - fontSizer.getAscent() +
fontSizer.getLeading() + fontSizer.getDescent()) / 2),
y + Math.round(height/2 - stringWidth/2));
return new Point(x + Math.round(width/2 - stringWidth/2),
y + ((height +
fontSizer.getAscent() -
fontSizer.getLeading() -
fontSizer.getDescent()) / 2));
} else { // VERTICAL
return new Point(x + ((width - fontSizer.getAscent() +
fontSizer.getLeading() + fontSizer.getDescent()) / 2),
y + Math.round(height/2 - stringWidth/2));
- relates to
-
JDK-8337457 Redundant Math.round call in AquaProgressBarUI#getStringPlacement
- Resolved