harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Okomin (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1799) [classlib][swing] JTextPane throws NPE after we set null font.
Date Tue, 10 Oct 2006 08:07:19 GMT
[classlib][swing] JTextPane throws NPE after we set null font.
--------------------------------------------------------------

                 Key: HARMONY-1799
                 URL: http://issues.apache.org/jira/browse/HARMONY-1799
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Ilya Okomin
            Priority: Minor


If we try to set JTextPane font to null Harmony throws NPE, while RI works silent.

Test to reproduce:
---------------test.java-------------
import javax.swing.JTextPane;

import junit.framework.*;
import junit.textui.TestRunner;

public class test extends TestCase{
    JTextPane textPane;

    public static void main(String args[]) throws Exception{
        TestRunner.run(test.class);
    }
    
    public void testRun() throws Exception{
        JTextPane textPane = new JTextPane();
        textPane.setFont(null);
    }
}
------------------------------

====== Ouput RI =======

.
Time: 0.991

OK (1 test)

====== Output Harmony ======

.E
Time: 0.531
There was 1 error:
1) testRun(test)java.lang.NullPointerException
	at javax.swing.plaf.basic.BasicTextPaneUI.updateFontAttributes(BasicTextPaneUI.java:89)
	at javax.swing.plaf.basic.BasicTextPaneUI.propertyChange(BasicTextPaneUI.java:49)
	at javax.swing.plaf.basic.BasicTextUI$Listener.propertyChange(BasicTextUI.java:300)
	at java.beans.PropertyChangeSupport.doFirePropertyChange(PropertyChangeSupport.java:332)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:56)
	at java.awt.Component.firePropertyChangeImpl(Component.java:1666)
	at java.awt.Component.firePropertyChange(Component.java:1680)
	at java.awt.Component.setFont(Component.java:3104)
	at java.awt.Container.setFont(Container.java:1059)
	at test.testRun(test.java:14)
	at java.lang.reflect.VMReflection.invokeMethod(Native Method)
	at test.main(test.java:10)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1

======================================

The reason of failure is uncompatible behavior with RI of the updating font style in javax.swing.plaf.basic.BasicTextPaneUI.
After innvestigation of this problem I found that in Harmony we do nothing if font is null,
or trying to access it's fields. And in RI if font is null its style attributes related to
Font just removed.

I'll provide unit test and fix for this issue.

-- 
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