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 Mon, 25 Dec 2006 12:18:15 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

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();

    public static void main(String[] args) {

------Output on RI------
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(
 at sun.reflect.DelegatingMethodAccessorImpl.invoke (
 at H2768.main(H2768.java:15)

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

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