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] Updated: (HARMONY-2430) [classlib][awt] DropTargetEvent(null) throws IAE while RI throws NPE
Date Tue, 12 Dec 2006 13:59:22 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-2430?page=all ]

Andrey Pavlenko updated HARMONY-2430:
-------------------------------------

    Attachment: DropTargetEvent.patch
                DropTargetEventTest.patch

The reason of IAE is java.util.EventObject constructor which does not accept null. In the
Harmony implementation of java.awt.dnd.DropTargetEvent constructor the dtc argument is passed
directly to the super constructor, thus, we have IAE in case dtc is null. In the RI super
constructor is invoked with dtc.getDropTarget() argument, but not with dtc. To demonstrate
that see the following example:

    public static void main(String[] args) {
        final DropTarget dt = new DropTarget();
        final DropTargetEvent e = new DropTargetEvent(dt.getDropTargetContext());

        System.out.println(e.getSource());
        System.out.println(e.getSource() == dt);
        new DropTargetEvent(null);
    }
Output:
java.awt.dnd.DropTarget@b8f82d
true
Exception in thread "main" java.lang.NullPointerException
	at java.awt.dnd.DropTargetEvent.<init>(DropTargetEvent.java:45)

Thus, we have NPE on the RI in case the dtc argument is null.

The attached patch fixes the issue.

> [classlib][awt] DropTargetEvent(null) throws IAE while RI throws NPE
> --------------------------------------------------------------------
>
>                 Key: HARMONY-2430
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2430
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Denis Kishenko
>         Attachments: DropTargetEvent.patch, DropTargetEventTest.patch
>
>
> ============= Test ===============
> import java.awt.dnd.DropTargetEvent;
> public class Test {
>     public static void main(String[] args) { 
>         new DropTargetEvent(null);
>     }           
> }
> =========== RI ==============
> java.lang.NullPointerException
>     at java.awt.dnd.DropTargetEvent.<init>(DropTargetEvent.java:45)
>     at Test.main(Test.java:6)
> =========== Harmony ========
> Uncaught exception in main:
> java.lang.IllegalArgumentException
>     at Test.main(Test.java:6)

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