-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
5.0
-
sparc
-
solaris_2.6
Name: sdR10048 Date: 08/15/2003
Filed By : SPB JCK team (###@###.###)
JDK : java full version "1.5.0-beta-b13"
Specification excerpt:
======================
--------- J2SE API spec v.1.5 ---------
...
public void dragEnter(DropTargetDragEvent dtde)
Calls dragEnter on the registered DropTargetListener and passes it the specified
DropTargetDragEvent. Has no effect if this DropTarget is not active.
Parameters:
dtde - the DropTargetDragEvent
Throws:
NullPointerException - if this DropTarget is active and dtde is null
...
---------- end-of-excerpt ---------------
Problem description
===================
Currently spec does not describe will DropTarget notify the registered listener
in case if this DropTarget is active and 'dtde' is null.
JDK 1.5.0 b13 does notify the listener with a null event.
The same issue with some other methods as well:
dragExit
dragOver
drop
dropActionChanged
Minimized test:
===============
------- T.java -------
import java.awt.dnd.*;
public class T implements DropTargetListener {
private String method = null;
public String getMethod() {
return method;
}
public void dragEnter(DropTargetDragEvent dsde) {method = "dragEnter";}
public void dragOver(DropTargetDragEvent dsde) {method = "dragOver";}
public void dropActionChanged(DropTargetDragEvent dsde) {method = "dropActionChanged";}
public void dragExit(DropTargetEvent dsde) {method = "dragExit";}
public void drop(DropTargetDropEvent dsde) {method = "drop";}
public T() {
}
public static void main(String[] args) {
DropTarget dt = new DropTarget();
T t = new T();
try {
dt.addDropTargetListener(t);
} catch (Exception e) {
e.printStackTrace();
}
dt.setActive(true);
System.out.println("t.getMethod(): "+t.getMethod());
try {
dt.dragEnter(null);
} catch (NullPointerException e) {
System.out.println("NPE: "+e);
}
System.out.println("t.getMethod(): "+t.getMethod());
}
}
------- end-of-T.java -------
Minimized test output:
======================
t.getMethod(): null
NPE: java.lang.NullPointerException
t.getMethod(): dragEnter
======================================================================
- relates to
-
JDK-4191708 Doc issue: inconsistency in java.awt.dnd.DropTarget
-
- Closed
-