I'm using JavaSoundAudioIO
in my project, which starts up a thread of its own. If it deems the chosen audio mixer unfit, it throws an UnsupportedArgumentException
, which will then crash the program. How can I catch this Exception? I can't really attach an exception handler directly to that thread, as I don't have a reference to it. I tried using Thread.setDefaultUncaughtExceptionHandler
from my main-thread, but that doesn't seem to do anything for the JavaSound-thread.
Asked
Active
Viewed 138 times
2

user1854611
- 121
- 8
-
2Could you show the exact stacktrace for the exception? – Vladimir Pligin Feb 11 '21 at 00:05
-
Also, could you show the line of code in which you use `JavaSoundAudioIO` (which causes that thread to be started behind your back) as well as your attempt at using `Thread.setDefaultUncaughtExceptionHandler`? – Julian Feb 11 '21 at 23:42
-
See my answer below, it was actually an issue with the Eclipse debugger. – user1854611 Feb 12 '21 at 01:29
1 Answers
0
I just found out that the Eclipse debugger was catching the exception and stopping execution before it could get to the exception handler.. Deactivated this behaviour in Preferences>Java>Debug and Thread.setDefaultUncaughtExceptionHandler
works as intended.

user1854611
- 121
- 8