Bounds constructor validation

Kevin Rushforth kevin.rushforth at oracle.com
Wed Oct 2 08:50:32 PDT 2013


Note that a negative width or height is considered empty (see 
Bounds.isEmpty()) so it might break something if you couldn't constuct 
such a bounds.

-- Kevin


Richard Bair wrote:
> Hi,
>
> I'm looking at https://javafx-jira.kenai.com/browse/RT-23446, where the argument is made that the width / height of a node (specifically, a Region's prefWidth, minWidth, maxWidth, prefHeight, minHeight, maxHeight) should never be negative. While looking at this, I noticed that in Node, the prefWidth method relies on the layoutBounds.getWidth(). However, the Bounds class itself does not appear to do any validation of the parameters passed to the Bounds. There are no checks for NaN, and no checks for negative width, height, depth.
>
> Is there any reason why we should allow NaN, or negative width / height / depth for Bounds?
>
> Richard


More information about the openjfx-dev mailing list