United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6625450 javax.swing.border.TitledBorder.getBaseline() doesn't throw IAE when width is < 0
JDK-6625450 : javax.swing.border.TitledBorder.getBaseline() doesn't throw IAE when width is < 0

Details
Type:
Bug
Submit Date:
2007-11-02
Status:
Closed
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2011-05-18
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:

Sub Tasks

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");
        }
                                     
2007-11-06



Hardware and Software, Engineered to Work Together