harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Pavlenko (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3430) [classlib][swing] DebugGraphics.getClip() throws NPE
Date Thu, 22 Mar 2007 14:56:32 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483167

Andrey Pavlenko commented on HARMONY-3430:

Moreover, the test provided by Vasily also fails if the container is visible. See the following
test case:

public void test() {
        final Frame f = new Frame();
        final DebugGraphics g = new DebugGraphics();

        try {
        } finally {

It looks like on RI the method Container.paint() do nothing with the Graphics object in case
the container is not visible.
I could create a patch to workaround this issue if it's necessary.

> [classlib][swing] DebugGraphics.getClip() throws NPE
> ----------------------------------------------------
>                 Key: HARMONY-3430
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3430
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>         Assigned To: Alexey Petrenko
>            Priority: Minor
> Consider the following test:
> import java.awt.Container;
> import javax.swing.DebugGraphics;
> public class Test {
>     public static void main(String args[]) throws Exception {
>         new Container().paint(new DebugGraphics());
>         System.out.println("SUCCESS");
>     }
> }
> Output on RI:
> Output on Harmony:
> Exception in thread "main" java.lang.NullPointerException
>         at javax.swing.DebugGraphics.getClip(DebugGraphics.java:769)
>         at java.awt.Container.paintComponentsImpl(Container.java:996)
>         at java.awt.Container.paint(Container.java:936)
>         at Test.main(Test.java:6)
> The reason for that is getClip() references originalGraphics field, that is initialized
with null by no-parameter constuctor.
> The same problem also exists for many other DebugGraphics methods that reference originalGraphics
> The proper resolution would be either checking originalGraphics for null each time before
using, or initialize originalGraphics with some non-null value. I'm not sure which way is
right to follow.

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

View raw message