Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P3
-
Resolution: Fixed
-
Affects Version/s: 9, 10
-
Fix Version/s: 12
-
Component/s: client-libs
-
Labels:None
-
Subcomponent:
-
Resolved In Build:b14
Description
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));