I managed to bypass the try catch block,
by nesting multiple threads.
Is therere some rule, where it is documented, when the try catch block is bypassed by Exceptions?
try{
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("Thread");
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
System.out.println("ThreadGUI");
throw new NullPointerException();
}
});
}
};
Thread t = new Thread(r);
t.start();
} catch(NullPointerException e) {
//nothing
}
System.out.println("Ende");
Exceptions don’t automatically propagate across thread boundaries. If you throw an exception in a particular thread, you can only catch it in that thread. The lexical structure of your code makes no difference in this respect.
The following are the relevant parts of the JLS: