When an exception is thrown from AnimationTimer::handle, the JavaFX application freezes. The reason is that the user exception will bubble up into framework code, preventing the normal operation of JavaFX.
Reproducer:
public class FailingAnimationTimer extends Application {
@Override
public void start(Stage stage) throws Exception {
var button = new Button("start timer");
button.setOnAction(_ -> {
var timer = new AnimationTimer() {
@Override
public void handle(long l) {
throw new RuntimeException("foo");
}
};
timer.start();
});
var root = new HBox();
root.getChildren().add(new TextField("test"));
root.getChildren().add(button);
stage.setScene(new Scene(root));
stage.show();
}
}
Reproducer:
public class FailingAnimationTimer extends Application {
@Override
public void start(Stage stage) throws Exception {
var button = new Button("start timer");
button.setOnAction(_ -> {
var timer = new AnimationTimer() {
@Override
public void handle(long l) {
throw new RuntimeException("foo");
}
};
timer.start();
});
var root = new HBox();
root.getChildren().add(new TextField("test"));
root.getChildren().add(button);
stage.setScene(new Scene(root));
stage.show();
}
}
- links to
-
Review(master) openjdk/jfx/1811