RFR: 8237372: NullPointerException in TabPaneSkin.stopDrag

Ambarish Rapte arapte at openjdk.java.net
Wed Jan 22 09:03:12 UTC 2020


On Mon, 20 Jan 2020 10:00:55 GMT, Robert Lichtenberger <rlichten at openjdk.org> wrote:

> Test simulates a single mouse-released event.
> Fix simply guards against the null case.

The scenario mentioned in [JDK-8237372](https://bugs.openjdk.java.net/browse/JDK-8237372) seems valid scenario. However I am not sure if the scenario can be avoided or not. Irrespective of that, the code in question should be corrected. Suggested a minor change.

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java line 2216:

> 2215:         // Animate tab header being dragged to its final position.
> 2216:         if (dragTabHeader != null) {
> 2217:             dragHeaderSourceX = dragTabHeader.getLayoutX();

This is a situation when reorder was not started.
So a check as `else if (dragState == DragState.REORDER)` seems more correct instead of `null` check. With this `else if` the `return;` on line 2213 can be removed.

-------------



PR: https://git.openjdk.java.net/jfx/pull/89


More information about the openjfx-dev mailing list