harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Petrenko (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-3204) [awt] Window.pack() throws NPE if the font of nested components is not set
Date Fri, 02 Mar 2007 07:30:50 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-3204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alexey Petrenko resolved HARMONY-3204.
--------------------------------------

    Resolution: Fixed

The patch has been applied.
Please verify.

> [awt] Window.pack() throws NPE if the font of nested components is not set
> --------------------------------------------------------------------------
>
>                 Key: HARMONY-3204
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3204
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrey Pavlenko
>         Assigned To: Alexey Petrenko
>         Attachments: HARMONY-3204-Window.patch, HARMONY-3204-WindowTest.patch
>
>
> The method Window.pack() throws NPE if the font of nested components is not set. See
the following example.
>     public void testPack() {
>         final Frame f = new Frame();
>         final Button b = new Button();
>         assertNull(b.getFont());
>         f.add(b);
>         assertNull(b.getFont());
>         assertFalse(b.isDisplayable());
>         f.pack();
>         assertTrue(f.isDisplayable());
>         assertTrue(b.isDisplayable());
>         assertNotNull(b.getFont());
>         assertNotNull(f.getFont());
>         f.dispose();
>     }
> Output:
> 1) testPack(AwtTest)java.lang.NullPointerException
> 	at org.apache.harmony.awt.gl.font.FontMetricsImpl.getFontPeer(FontMetricsImpl.java:240)
> 	at org.apache.harmony.awt.gl.font.FontMetricsImpl.<init>(FontMetricsImpl.java:60)
> 	at org.apache.harmony.awt.gl.CommonGraphics2DFactory.getFontMetrics(CommonGraphics2DFactory.java:57)
> 	at java.awt.ToolkitImpl.getFontMetrics(ToolkitImpl.java:136)
> 	at java.awt.Component$ComponentState.getFontMetrics(Component.java:773)
> 	at org.apache.harmony.awt.theme.DefaultButton.calculate(DefaultButton.java)
> 	at org.apache.harmony.awt.Theme.calculateButton(Theme.java)
> 	at java.awt.Button$State.calculate(Button.java:125)
> 	at java.awt.Button.addNotify(Button.java:203)
> 	at java.awt.Container.addNotify(Container.java:447)
> 	at java.awt.Window.addNotify(Window.java:207)
> 	at java.awt.Frame.addNotify(Frame.java:185)
> 	at java.awt.Component.mapToDisplay(Component.java:1412)
> 	at java.awt.Container.mapToDisplay(Container.java)
> 	at java.awt.Window.pack(Window.java:697)
> 	at AwtTest.testPack(AwtTest.java:146)
> 	at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> 	at AwtTest.main(AwtTest.java:176)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message