harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Irlyanov" <irlya...@gmail.com>
Subject [classlib][swing]Compartibility or non-bug diff?
Date Tue, 26 Dec 2006 16:07:02 GMT
 Dear community,

During investigation JIRA number 2768 I've found the following issue:
In short, the problem is in unsuspected NPE in Harmony if you call
repaint(rectangle=null).

This exception is logical, but the issue fully corresponds compartibility
criteria (there is no mention of this condition in the specification and
RI's DefaultListCellRenderer.repaint(null) doesn't throw the NPE).

According to spec, the method repaint(rectangle) in DefaultListCellRenderer
is overridden for performance reasons thus all the functionality should
remains, but if you call, for example, JLabel.repaint(rect)
NullPointerException is thrown.

Third argument is the probable performance loss.

Should overriden method throw NPE?

------Test shows that default JComponent.repaint(null) do throws NPE------
import javax.swing.JLabel;

import junit.framework.TestCase;
import junit.textui.TestRunner;

public class H2768 extends TestCase {

    public void testcase1() {
        JLabel pi = new JLabel();
        pi.repaint(null);
    }

    public static void main(String[] args) {
        TestRunner.run(H2768.class);
    }
}

------Output on RI------
.E
Time: 0.14
There was 1 error:
1) testcase1(H2768)java.lang.NullPointerException
 at javax.swing.JComponent.repaint(JComponent.java:4532)
 at H2768.testcase1 (H2768.java:11)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke (
DelegatingMethodAccessorImpl.java:25)
 at H2768.main(H2768.java:15)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1
_______________
With Best Regards,
Irlyanov Dmitry
Intel Corporation
Middleware Products Division

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message