JDK-6625450 : javax.swing.border.TitledBorder.getBaseline() doesn't throw IAE when width is < 0
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-11-02
  • Updated: 2012-03-22
  • Resolved: 2011-05-18
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 6 JDK 7
6u14Fixed 7 b27Fixed
Description
The spec ( http://java.sun.com/javase/6/docs/api/javax/swing/border/TitledBorder.html#getBaseline(java.awt.Component,%20int,%20int) ) says:

Throws:
    IllegalArgumentException - if width or height is < 0

For example, the following lines of code will throw nothing:

    new TitledBorder("123").getBaseline( new Button(), -1, 0 );
    new TitledBorder("123").getBaseline( new Component() {}, Integer.MIN_VALUE, 0 );

Comments
EVALUATION TitledBrder should do the same as its super class does: if (width < 0 || height < 0) { throw new IllegalArgumentException( "Width and height must be >= 0"); }
06-11-2007