Enhancement
Critical
Major
Detail
Detail
Is extracted from ticket #26142.
The NullPointerException is a general problem caused by the switch with pre-validation by ticket #23472.
For security reasons, browsers only provide event.dataTransfer while handling a drop, otherwise the value is undefined. As a result of the changes in #23472, the drag-and-drop data is now held on the window object, specifically in window.tlDnDData. These are filled on dragStart. In particular, this way the data is also available at dragOver and can be included in the calculation to assess whether a drop is possible at this point.
The NullPointerException arises now, if an arbitrary text (e.g. the component name in the toolbar), which does not originate from a table or tree, is dragged over a component, which possesses a drop handler. Because the handler that fills the window.tlDnDData is not executed at dragStart, since the event handler is only registered for tables and trees, the data is empty and thus the DnD cannot be parsed at dragOver. Finally you get a NullPointerException.
Implementation
- The exception can be prevented by an additional check in the dragOver for the existence of window.tlDnDData.
- The content of window.tlDnDate is reset at the end of a drag operation, so that after a valid drag&drop and subsequent drag&drop of a text you do not get an inconsistent state.
Test
Navigate to the Technical Demo > Components > Drag & Drop view and drag a text onto the factory plan. No exception should be thrown.