-
Bug
-
Resolution: Fixed
-
P4
-
8
-
None
-
Java 1.8.0ea b90
I am setting an UncaughtExceptionHandler on the JavaFX application thread now that bug RT-15332 has been resolved but I have noticed that if I "showAndWait" an error dialog from my UncaughExceptionHandler it will not fully paint itself onscreen in Linux.
Please run the following test case in Linux to reproduce the bug (this test case works fine in Windows).
--------------------------------------------------------------------------------------------
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread.UncaughtExceptionHandler;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class ExceptionTest extends Application {
@Override
public void start(final Stage primaryStage) throws Exception {
Thread.currentThread().setUncaughtExceptionHandler(
new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
Stage errorDialog = new Stage();
errorDialog.initModality(Modality.APPLICATION_MODAL);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
TextArea area = new TextArea(sw.toString());
errorDialog.setScene( new Scene(new StackPane(area)) );
errorDialog.showAndWait();
}
});
primaryStage.setWidth(600);
primaryStage.setHeight(400);
primaryStage.centerOnScreen();
final Button button = new Button("Throw Exception...");
button.setFocusTraversable(false);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent arg0) {
throw new RuntimeException("Bogus Error...");
}
});
primaryStage.setScene( new Scene(new StackPane(button)) );
primaryStage.show();
}
public static void main(String[] args) throws Exception{
launch(args);
}
}
Please run the following test case in Linux to reproduce the bug (this test case works fine in Windows).
--------------------------------------------------------------------------------------------
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread.UncaughtExceptionHandler;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class ExceptionTest extends Application {
@Override
public void start(final Stage primaryStage) throws Exception {
Thread.currentThread().setUncaughtExceptionHandler(
new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
Stage errorDialog = new Stage();
errorDialog.initModality(Modality.APPLICATION_MODAL);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
TextArea area = new TextArea(sw.toString());
errorDialog.setScene( new Scene(new StackPane(area)) );
errorDialog.showAndWait();
}
});
primaryStage.setWidth(600);
primaryStage.setHeight(400);
primaryStage.centerOnScreen();
final Button button = new Button("Throw Exception...");
button.setFocusTraversable(false);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent arg0) {
throw new RuntimeException("Bogus Error...");
}
});
primaryStage.setScene( new Scene(new StackPane(button)) );
primaryStage.show();
}
public static void main(String[] args) throws Exception{
launch(args);
}
}