|
Quick Lists
|
|
Bug ID:
|
4907369
|
|
Votes
|
0
|
|
Synopsis
|
DropTarget notify methods inconsistency
|
|
Category
|
java:dragndrop
|
|
Reported Against
|
1.5
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Not a Defect,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4191708
|
|
Submit Date
|
15-AUG-2003
|
|
Description
|
Filed By : SPB JCK team ( xxxxx@xxxxx )
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
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
I can't agree that "spec does not describe will DropTarget notify the registered listener in case if this DropTarget is active and 'dtde' is null". If the
exceptional conditions [(a) this DropTarget is not active, or (b) this DropTarget
is active and dtde is null] are not satisfied, then the method obeys the general
statement "Calls dragEnter on the registered DropTargetListener and passes it the
specified DropTargetDragEvent" and does notify the registered listener.
This documentation was worked out per a JCK request to specify the existing
behavior (refer to the CCC 4191708). So this CR is not a defect.
xxxxx@xxxxx 2005-1-21 16:43:56 GMT
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |