harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vasily Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2896) [classlib][swing] Compatibility: javax.swing.plaf.basic.BasicComboBoxUI. getAccessibleChildrenCount(null) does not throw unspecified NPE
Date Mon, 08 Jan 2007 01:13:27 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-2896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462915
] 

Vasily Zakharov commented on HARMONY-2896:
------------------------------------------

Interesting is effect remains the same if getAccessibleChildrenCount() method parameter is
set to non-null value, for example "new JComponent() {}".
In other words NPE occuring on RI is caused by some other field, probably comboBox, like in
HARMONY-2898.

Consider the following simple test:

import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.plaf.basic.BasicComboBoxUI;

public class Test {
    public static void main(String[] args) throws Exception {
        BasicComboBoxUI ui = new BasicComboBoxUI();
        JComponent c = new JComponent() {};
        // ui.installUI(new JComboBox());
        System.out.println(ui.getAccessibleChildrenCount(c));
        System.out.println(ui.getAccessibleChildrenCount(null));
    }
}

Output on RI:

Exception in thread "main" java.lang.NullPointerException
        at javax.swing.plaf.basic.BasicComboBoxUI.getAccessibleChildrenCount(BasicComboBoxUI.java:883)
        at Test.main(Test.java:10)

On Harmony:

0
0

If the installUI() call is uncommented, the output on RI changes to:

1
1

So probably the field checked is really comboBox, initialized by installUI().


> [classlib][swing] Compatibility: javax.swing.plaf.basic.BasicComboBoxUI. getAccessibleChildrenCount(null)
does not throw unspecified NPE
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2896
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2896
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ilya Okomin
>            Priority: Minor
>
> There is no mention of any exception in the specification.
> RI throws unspecified NPE for javax.swing.plaf.basic.BasicComboBoxUI.getAccessibleChildrenCount(null)
while Harmony does not.
> Next test case passes on RI and fails on Harmony:
> --------- test.java ----------
> import javax.swing.plaf.basic.BasicComboBoxUI;
> import junit.framework.TestCase;
> import junit.textui.TestRunner;
> public class test extends TestCase {
>     public static void main(String args[]) {
>         TestRunner.run(test.class);
>     }
>     public void testRun() {
>         BasicComboBoxUI cb = new BasicComboBoxUI();
>         try {
>             cb.getAccessibleChildrenCount(null);
>             fail("NullPointerException expected");
>         } catch (NullPointerException e) {
>             // expected
>         }
>     }
> }
> --------------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message