-
Bug
-
Resolution: Fixed
-
P3
-
6u3, 7
-
b114
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2185282 | 6-pool | Unassigned | P4 | Closed | Won't Fix |
Unexpected IAE is thrown for (valid) width/height values = 0, 1, 2, 3:
Exception in thread "main" java.lang.IllegalArgumentException: Width and height must be >= 0
at javax.swing.plaf.ComponentUI.getBaseline(ComponentUI.java:274)
at javax.swing.plaf.basic.BasicComboBoxUI.getBaseline(BasicComboBoxUI.java:900)
at javax.swing.plaf.metal.MetalComboBoxUI.getBaseline(MetalComboBoxUI.java:132)
Please see the following code sample:
MetalComboBoxUI ui = new MetalComboBoxUI();
ui.installUI(new JComboBox());
// IAE thrown from any of the following lines
ui.getBaseline(new JComboBox(), 0, 0);
ui.getBaseline(new JComboBox(), 0, 1);
ui.getBaseline(new JComboBox(), 1, 0);
ui.getBaseline(new JComboBox(), 1, 1);
ui.getBaseline(new JComboBox(), 2, 2);
...
ui.getBaseline(new JComboBox(), 2, 3);
ui.getBaseline(new JComboBox(), 3, 3);
The following JCK test fails due to this problem:
api/java_awt/Component/index.html#BaselineRelatedTests[comboBoxUI_01]
api/java_awt/Component/index.html#BaselineRelatedTests[comboBoxUI_03]
Exception in thread "main" java.lang.IllegalArgumentException: Width and height must be >= 0
at javax.swing.plaf.ComponentUI.getBaseline(ComponentUI.java:274)
at javax.swing.plaf.basic.BasicComboBoxUI.getBaseline(BasicComboBoxUI.java:900)
at javax.swing.plaf.metal.MetalComboBoxUI.getBaseline(MetalComboBoxUI.java:132)
Please see the following code sample:
MetalComboBoxUI ui = new MetalComboBoxUI();
ui.installUI(new JComboBox());
// IAE thrown from any of the following lines
ui.getBaseline(new JComboBox(), 0, 0);
ui.getBaseline(new JComboBox(), 0, 1);
ui.getBaseline(new JComboBox(), 1, 0);
ui.getBaseline(new JComboBox(), 1, 1);
ui.getBaseline(new JComboBox(), 2, 2);
...
ui.getBaseline(new JComboBox(), 2, 3);
ui.getBaseline(new JComboBox(), 3, 3);
The following JCK test fails due to this problem:
api/java_awt/Component/index.html#BaselineRelatedTests[comboBoxUI_01]
api/java_awt/Component/index.html#BaselineRelatedTests[comboBoxUI_03]
- backported by
-
JDK-2185282 MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
- Closed
- duplicates
-
JDK-6980211 MetalComboBoxUI.getBaseline() unexpectedly throws IAE for width < 4
- Closed
-
JDK-6633517 javax.swing.plaf.metal.MetalComboBoxUI.getBaseline(JComponent, int, int) doesn't throwIAE
- Closed
-
JDK-2185281 javax.swing.plaf.metal.MetalComboBoxUI.getBaseline(JComponent, int, int) doesn't throwIAE
- Closed