-
Bug
-
Resolution: Unresolved
-
P4
-
jfx11, 8, 9, 10
-
x86_64
-
windows
FULL PRODUCT VERSION :
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7, 64 bit, professional
A DESCRIPTION OF THE PROBLEM :
If an exception is thrown accidently in a touch release event handler then subsequent events are not correct. This could be a NullPointerException, IndexOutOfBoundsException or other programming fault.
After an exception has been thrown the next two touch events are not received. After this events are received as normal.
From my investigation I've found that the exception prevents state management code in javafx.scene.Scene.processTouchEvent(TouchEvent, TouchPoint[]) being executed after Event.fireEvent() call. This means that the field Scene.touchTargets is incorrect after the exception has been thrown.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test case with touch hardware.
Touch press in the stage
Touch release in the stage
Touch press in the stage
Touch release in the stage
Touch press in the stage
Touch release in the stage
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed and also the exception
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed
ACTUAL -
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed and also the exception
Touch press - see "RELEASED 1" is printed <== expected "PRESSED 1"
Touch release - see "RELEASED 2" is printed <== expected "RELEASED 1"
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.RuntimeException: Too many touch points reported
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.touchEventNext(Scene.java:2838)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleNextTouchEvent$26(GlassViewEventHandler.java:1311)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleNextTouchEvent$27(GlassViewEventHandler.java:1274)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleNextTouchEvent(GlassViewEventHandler.java:1273)
at javafx.graphics/com.sun.glass.ui.View.handleNextTouchEvent(View.java:580)
at javafx.graphics/com.sun.glass.ui.View.notifyNextTouchEvent(View.java:1055)
at javafx.graphics/com.sun.glass.ui.TouchInputSupport.notifyNextTouchEvent(TouchInputSupport.java:142)
at javafx.graphics/com.sun.glass.ui.win.WinGestureSupport.notifyNextTouchEvent(WinGestureSupport.java:58)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
at java.base/java.lang.Thread.run(Thread.java:844)
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: Error in swipe gesture recognition: reported unknown touch point
at javafx.graphics/com.sun.javafx.tk.quantum.SwipeGestureRecognizer$MultiTouchTracker.progress(SwipeGestureRecognizer.java:317)
at javafx.graphics/com.sun.javafx.tk.quantum.SwipeGestureRecognizer.notifyNextTouchEvent(SwipeGestureRecognizer.java:76)
at javafx.graphics/com.sun.javafx.tk.quantum.GestureRecognizers.notifyNextTouchEvent(GestureRecognizers.java:73)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleNextTouchEvent(GlassViewEventHandler.java:1328)
at javafx.graphics/com.sun.glass.ui.View.handleNextTouchEvent(View.java:580)
at javafx.graphics/com.sun.glass.ui.View.notifyNextTouchEvent(View.java:1055)
at javafx.graphics/com.sun.glass.ui.TouchInputSupport.notifyNextTouchEvent(TouchInputSupport.java:142)
at javafx.graphics/com.sun.glass.ui.win.WinGestureSupport.notifyNextTouchEvent(WinGestureSupport.java:58)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
at java.base/java.lang.Thread.run(Thread.java:844)
REPRODUCIBILITY :
This bug can be reproduced occasionally.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.input.TouchEvent;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class TouchProcessingException extends Application {
private boolean thrown;
@Override
public void start(Stage stage) throws Exception {
HBox root = new HBox();
root.addEventHandler(TouchEvent.TOUCH_RELEASED, event -> {
System.out.println(String.format("%s %s", event.getTouchPoint().getState(), event.getTouchPoint().getId()));
if (!thrown) {
thrown = true;
throw new IllegalStateException("Don't touch me");
}
});
root.addEventHandler(TouchEvent.TOUCH_PRESSED, event -> {
System.out.println(String.format("%s %s", event.getTouchPoint().getState(), event.getTouchPoint().getId()));
});
stage.setScene(new Scene(root, 400, 300));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Wrap user supplied event handlers with try catch blocks to swallow any programming exceptions. This prevents upsetting of JavaFX touch processing internals.
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7, 64 bit, professional
A DESCRIPTION OF THE PROBLEM :
If an exception is thrown accidently in a touch release event handler then subsequent events are not correct. This could be a NullPointerException, IndexOutOfBoundsException or other programming fault.
After an exception has been thrown the next two touch events are not received. After this events are received as normal.
From my investigation I've found that the exception prevents state management code in javafx.scene.Scene.processTouchEvent(TouchEvent, TouchPoint[]) being executed after Event.fireEvent() call. This means that the field Scene.touchTargets is incorrect after the exception has been thrown.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test case with touch hardware.
Touch press in the stage
Touch release in the stage
Touch press in the stage
Touch release in the stage
Touch press in the stage
Touch release in the stage
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed and also the exception
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed
ACTUAL -
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed and also the exception
Touch press - see "RELEASED 1" is printed <== expected "PRESSED 1"
Touch release - see "RELEASED 2" is printed <== expected "RELEASED 1"
Touch press - see "PRESSED 1" is printed
Touch release - see "RELEASED 1" is printed
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.RuntimeException: Too many touch points reported
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.touchEventNext(Scene.java:2838)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleNextTouchEvent$26(GlassViewEventHandler.java:1311)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleNextTouchEvent$27(GlassViewEventHandler.java:1274)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleNextTouchEvent(GlassViewEventHandler.java:1273)
at javafx.graphics/com.sun.glass.ui.View.handleNextTouchEvent(View.java:580)
at javafx.graphics/com.sun.glass.ui.View.notifyNextTouchEvent(View.java:1055)
at javafx.graphics/com.sun.glass.ui.TouchInputSupport.notifyNextTouchEvent(TouchInputSupport.java:142)
at javafx.graphics/com.sun.glass.ui.win.WinGestureSupport.notifyNextTouchEvent(WinGestureSupport.java:58)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
at java.base/java.lang.Thread.run(Thread.java:844)
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: Error in swipe gesture recognition: reported unknown touch point
at javafx.graphics/com.sun.javafx.tk.quantum.SwipeGestureRecognizer$MultiTouchTracker.progress(SwipeGestureRecognizer.java:317)
at javafx.graphics/com.sun.javafx.tk.quantum.SwipeGestureRecognizer.notifyNextTouchEvent(SwipeGestureRecognizer.java:76)
at javafx.graphics/com.sun.javafx.tk.quantum.GestureRecognizers.notifyNextTouchEvent(GestureRecognizers.java:73)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleNextTouchEvent(GlassViewEventHandler.java:1328)
at javafx.graphics/com.sun.glass.ui.View.handleNextTouchEvent(View.java:580)
at javafx.graphics/com.sun.glass.ui.View.notifyNextTouchEvent(View.java:1055)
at javafx.graphics/com.sun.glass.ui.TouchInputSupport.notifyNextTouchEvent(TouchInputSupport.java:142)
at javafx.graphics/com.sun.glass.ui.win.WinGestureSupport.notifyNextTouchEvent(WinGestureSupport.java:58)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
at java.base/java.lang.Thread.run(Thread.java:844)
REPRODUCIBILITY :
This bug can be reproduced occasionally.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.input.TouchEvent;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class TouchProcessingException extends Application {
private boolean thrown;
@Override
public void start(Stage stage) throws Exception {
HBox root = new HBox();
root.addEventHandler(TouchEvent.TOUCH_RELEASED, event -> {
System.out.println(String.format("%s %s", event.getTouchPoint().getState(), event.getTouchPoint().getId()));
if (!thrown) {
thrown = true;
throw new IllegalStateException("Don't touch me");
}
});
root.addEventHandler(TouchEvent.TOUCH_PRESSED, event -> {
System.out.println(String.format("%s %s", event.getTouchPoint().getState(), event.getTouchPoint().getId()));
});
stage.setScene(new Scene(root, 400, 300));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Wrap user supplied event handlers with try catch blocks to swallow any programming exceptions. This prevents upsetting of JavaFX touch processing internals.