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] Commented: (HARMONY-2848) [classlib][swing] j.s.plaf.metal.MetalLookAndFeel.loadSystemColors() throws unspecified NPE
Date Fri, 22 Dec 2006 12:33:27 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-2848?page=comments#action_12460448 ] 
Alexey A. Ivanov commented on HARMONY-2848:

Investigation shows that we are compatible with RI in case where useNative parameter is false,
it's in the second try statement in the attached application.

If the String[] array contains only one element, then both throw ArrayIndexOutOfBoundsException,
i.e. the line looks as follows:
            lf.loadSystemColors(null, new String[] {"aa"}, false);

If this array has two elements, and the second element in the array represents an Integer,
then both RI and Harmony throw NPE.
            lf.loadSystemColors(null, new String[] {"aa", "1"}, false);

But in case where the second element of the array can't be parsed into an Integer, like
            lf.loadSystemColors(null, new String[] {"aa", "b"}, false);

RI prints two stack-traces:
java.lang.NumberFormatException: For input string: "b"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	at java.lang.Integer.parseInt(Integer.java:447)
	at java.lang.Integer.valueOf(Integer.java:526)
	at java.lang.Integer.decode(Integer.java:919)
	at java.awt.Color.decode(Color.java:694)
	at javax.swing.plaf.basic.BasicLookAndFeel.loadSystemColors(BasicLookAndFeel.java:252)
	at HTest2848$TestMetalLookAndFeel.loadSystemColors(HTest2848.java:8)
	at HTest2848.main(HTest2848.java:22)
	at javax.swing.plaf.basic.BasicLookAndFeel.loadSystemColors(BasicLookAndFeel.java:257)
	at HTest2848$TestMetalLookAndFeel.loadSystemColors(HTest2848.java:8)
	at HTest2848.main(HTest2848.java:22)
------ end of RI output --------

In this same case Harmony prints only NumberFormatException:
java.lang.NumberFormatException: b
	at java.lang.Integer.parse(Integer.java:389)
	at java.lang.Integer.decode(Integer.java:185)
	at javax.swing.plaf.basic.BasicLookAndFeel.loadColors(BasicLookAndFeel.java:922)
	at javax.swing.plaf.basic.BasicLookAndFeel.loadSystemColors(BasicLookAndFeel.java:64)
	at HTest2848$TestMetalLookAndFeel.loadSystemColors(HTest2848.java:8)
	at HTest2848.main(HTest2848.java:22)
------ end of Harmony -------

If we pass non-null parameter in place of UIDefaults, then for those parameters which can't
be parsed as Integer, it adds ColorUIResource[r=0,g=0,b=0] value. Try this for example:
            TestMetalLookAndFeel lf = new TestMetalLookAndFeel();
            lf.loadSystemColors(defaults, new String[] {"aa", "b", "cc", "e"}, false);

> [classlib][swing] j.s.plaf.metal.MetalLookAndFeel.loadSystemColors() throws unspecified
> -------------------------------------------------------------------------------------------
>                 Key: HARMONY-2848
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2848
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Alexey A. Ivanov
>            Priority: Minor
>         Attachments: HTest2848.java
> javax.swing.plaf.metal.MetalLookAndFeel.loadSystemColors() throws unspecified NPE on
Harmony whereas it works silently on Harmony.

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


View raw message