harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey A. Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2903) [classlib][swing] j.s.plaf.basic.BasicOptionPaneUI.getIconForType() doesn't throw NPE
Date Wed, 27 Dec 2006 15:41:21 GMT
[classlib][swing] j.s.plaf.basic.BasicOptionPaneUI.getIconForType() doesn't throw NPE
-------------------------------------------------------------------------------------

                 Key: HARMONY-2903
                 URL: http://issues.apache.org/jira/browse/HARMONY-2903
             Project: Harmony
          Issue Type: Bug
          Components: Classlib, Non-bug differences from RI
            Reporter: Alexey A. Ivanov
            Priority: Minor


javax.swing.plaf.basic.BasicOptionPaneUI.getIconForType(int) returns non-null icon whereas
RI throws NPE:

java.lang.NullPointerException
	at sun.swing.DefaultLookup.get(DefaultLookup.java:81)
	at javax.swing.plaf.basic.BasicOptionPaneUI.getIconForType(BasicOptionPaneUI.java:551)
	at Test$TestBasicOptionPaneUI.getIconForType(Test.java:8)
	at Test.main(Test.java:14)


Note: if UI is associated with a JOptionPane, then RI returns an icon too and no exception
is thrown.
(Add the following line before System.out:
        bop.installUI(new JOptionPane());
)

======= Code to Reproduce =======
import javax.swing.Icon;
import javax.swing.plaf.basic.BasicOptionPaneUI;

public class Test {
    private static class TestBasicOptionPaneUI extends BasicOptionPaneUI {
        @Override
        public Icon getIconForType(int i) {
            return super.getIconForType(i);
        }
    }

    public static void main(String[] args) {
        TestBasicOptionPaneUI bop = new TestBasicOptionPaneUI();
        System.out.println(bop.getIconForType(0));
    }
}
======= end of code =======

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

        

Mime
View raw message