JDK-8126442 : Negative height or width should be forbidden
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 7u6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2012-07-16
  • Updated: 2015-06-17
  • Resolved: 2013-10-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Duplicate :  
Description
Look at the attached test case, and in SB linked issue :
the API allows negative values. It does not make sense.
Only specific value such as -1 (USE_COMPUTED_SIZE) or -Infinity (USE_PREF_SIZE) should be permitted when it is possible.
Comments
Verified with 8b117
26-11-2013

Changeset: d70c498de565 Author: rbair Date: 2013-10-02 13:59 -0700 URL: http://hg.openjdk.java.net/openjfx/8/graphics/rt/rev/d70c498de565 RT-23446: Negative height or width should be forbidden Reviewed-by: msladecek ! modules/graphics/src/main/java/javafx/scene/Group.java ! modules/graphics/src/main/java/javafx/scene/Node.java ! modules/graphics/src/main/java/javafx/scene/Parent.java ! modules/graphics/src/main/java/javafx/scene/layout/Region.java ! modules/graphics/src/test/java/javafx/scene/GroupTest.java + modules/graphics/src/test/java/javafx/scene/Node_layoutSizes_Test.java ! modules/graphics/src/test/java/javafx/scene/layout/RegionTest.java ! modules/swing/src/main/java/javafx/embed/swing/SwingNode.java ! modules/web/src/main/java/javafx/scene/web/WebView.java
03-10-2013

If we're going to be hard-core, we also should deal with NaN
01-10-2013

prefWidth / prefHeight / etc are fully bindable properties, so we really don't want to forbid any type of input. However, what we can do is on the prefWidth(height), etc methods is to ensure that the returned value is >= 0. That would be easy to do and seems entirely safe.
01-10-2013

This is an issue with Region, not UI controls.
24-01-2013