Application code only runs on the app thread. Setting the uncaught exception handler should work for you.

Steve

On 2014-05-23 8:33 AM, ngalarn...@abinitio.com wrote:
How can we be notified of exceptions like these programmatically?

When my code is on the call stack, I can catch the exception
programmatically.

In this stack trace, only JavaFX code is there, but I still want to know
that something bad happened.

For the case of the JavaFX Application Thread, I guess I could do a
Platform.runLater & in that code call

         Thread.currentThread().setUncaughtExceptionHandler(myHandler)  //
ugh! Do I need to save away the previous one & chain to it?

Is that the best way for this thread?

What about JavaFX's other threads? Does application code ever run on those
threads?

How can I know that something went wrong on those threads? Even if my code
never runs there, I still want an automated way to know if something went
wrong.


Thanks,

Neil




From:   Scott Palmer <swpal...@gmail.com>
To:     "openjfx-dev@openjdk.java.net" <openjfx-dev@openjdk.java.net>,
Date:   05/22/2014 03:56 PM
Subject:        Re: Layout regression
Sent by:        "openjfx-dev" <openjfx-dev-boun...@openjdk.java.net>



This appears to be a bug introduced in JavaFX 8
I have filed https://javafx-jira.kenai.com/browse/RT-37252 and will
work on a test case.

Scott

On Thu, May 22, 2014 at 3:45 PM, Scott Palmer <swpal...@gmail.com> wrote:
I'm investigating an issue with my application where things are
working fine running with JavaFX 2.2 on 7u55, but I have a particular
case where 8u5 is throwing the following exception during layout:

Exception in thread "JavaFX Application Thread"
java.lang.NullPointerException
at javafx.scene.layout.GridPane.computeMinHeights(GridPane.java:1450)
at javafx.scene.layout.GridPane.computeMinHeight(GridPane.java:1224)
at javafx.scene.Parent.minHeight(Parent.java:946)
at javafx.scene.layout.Region.minHeight(Region.java:1404)
at
javafx.scene.layout.Region.computeChildMinAreaHeight(Region.java:1700)
at javafx.scene.layout.Region.getMaxAreaHeight(Region.java:1981)
at javafx.scene.layout.Region.computeMaxMinAreaHeight(Region.java:1854)
at javafx.scene.layout.StackPane.computeMinHeight(StackPane.java:293)
at javafx.scene.Parent.minHeight(Parent.java:946)
at javafx.scene.layout.Region.minHeight(Region.java:1404)
at
javafx.scene.layout.Region.computeChildPrefAreaHeight(Region.java:1765)
at javafx.scene.layout.Region.getMaxAreaHeight(Region.java:1982)
at javafx.scene.layout.Region.computeMaxPrefAreaHeight(Region.java:1884)
at javafx.scene.layout.StackPane.computePrefHeight(StackPane.java:310)
at javafx.scene.Parent.prefHeight(Parent.java:918)
at javafx.scene.layout.Region.prefHeight(Region.java:1438)
at
com.sun.javafx.scene.control.skin.TitledPaneSkin.computePrefHeight(TitledPaneSkin.java:249)
at javafx.scene.control.Control.computePrefHeight(Control.java:543)
at javafx.scene.Parent.prefHeight(Parent.java:918)
at javafx.scene.layout.Region.prefHeight(Region.java:1438)
at
javafx.scene.layout.Region.computeChildPrefAreaHeight(Region.java:1765)
at javafx.scene.layout.GridPane.computePrefHeights(GridPane.java:1407)
at javafx.scene.layout.GridPane.computePrefHeight(GridPane.java:1242)
at javafx.scene.Parent.prefHeight(Parent.java:918)
at javafx.scene.layout.Region.prefHeight(Region.java:1438)
at
com.sun.javafx.scene.control.skin.ScrollPaneSkin.computeScrollNodeSize(ScrollPaneSkin.java:916)
at
com.sun.javafx.scene.control.skin.ScrollPaneSkin.layoutChildren(ScrollPaneSkin.java:791)
at javafx.scene.control.Control.layoutChildren(Control.java:574)
at javafx.scene.Parent.layout(Parent.java:1076)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Scene.doLayoutPass(Scene.java:576)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2386)
at com.sun.javafx.tk.Toolkit$3.run(Toolkit.java:321)
at com.sun.javafx.tk.Toolkit$3.run(Toolkit.java:319)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:319)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:348)
at
com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:479)
at
com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:460)
at
com.sun.javafx.tk.quantum.QuantumToolkit$13.run(QuantumToolkit.java:327)
at
com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at
com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:745)

As you can see, it's all JavaFX code on the stack, so this is a little
tricky to debug.  As such I'm not sure yet if this is a JavaFX bug
introduced with 8.0 or an application bug that was masked in JavaFX
2.2 and is now showing up in JavaFX 8.

This happens when the managed/visible state of children changes.. but
I think it only for the case when all the children become unmanaged.

Once it happens JavaFX is crippled and pretty much all layout is
broken.  Popups (menus) still work and I can exit the application, but
all layout in the main window seems to not happen anymore.  Manual
positioning of nodes still works though.

I'll try to isolate a reproducible test case and file a bug report of
course.
Scott


NOTICE from Ab Initio: This email (including any attachments) may contain
information that is subject to confidentiality obligations or is legally
privileged, and sender does not waive confidentiality or privilege. If
received in error, please notify the sender, delete this email, and make
no further use, disclosure, or distribution.

Reply via email to