Exceptions silently swallowed in DnD listeners, windows only
adam at adamish.com
adam at adamish.com
Fri Apr 21 06:19:16 UTC 2017
Exceptions silently swallowed in DnD listeners... but only on Windows,
and even in latest 1.8u121 release... This appears to be a bug??
I've written up here
http://stackoverflow.com/questions/43488321/javafx-silently-swallowing-exception-raised-in-drag-listeners/43535229#43535229
Short version.... if you have a handler that throws an exception, then
this is silently swallowed, nothing seen in console...
destination
.
setOnDragOver
(
new
EventHandler
<
DragEvent
>()
{
public
void
handle
(
DragEvent
event
)
{
event
.
acceptTransferModes
(
TransferMode
.
LINK
);
String
nullReference
=
null
;
nullReference
.
toCharArray
();
// cause an exception
event
.
consume
();
}
});
My investigation so far....
It appears that native method WinDnDClipboard.push(Object[], int) -
backed by GlassClipboard.cpp [1] swallows the exception silently. A
call back to Throwable.getMessage() can be seen in the debugger but no
exception is printed to the console.
The Java 9 version of this file
(http://hg.openjdk.java.net/openjfx/9-dev/rt/file/1a3f128518cd/modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp
[2]) has an additional call to CheckAndClearException(env); as defined
in Utils.cpp, however this is against RT-35400 which appears
unrelated. This has not been backported to Java 8.
Thanks,
Adam
Links:
------
[1]
http://hg.openjdk.java.net/openjfx/8/master/rt/file/tip/modules/graphics/src/main/native-glass/win/GlassClipboard.cpp
[2]
http://hg.openjdk.java.net/openjfx/9-dev/rt/file/1a3f128518cd/modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp
More information about the openjfx-dev
mailing list