Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1004559 // Test setDefaultUncaughtExceptionHandler [WORKS! :)]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1070L/7K/26K).

!752

p {
  Thread t = startThread("Bla", r { while licensed { sleep(100); } });
  Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
    public void uncaughtException(Thread t, Throwable e) {
      print("Uncaught exception in " + t + "!");
      S msg = getInnerMessage(e);
      if (eq(msg, "Thread cancelled.")) {
        print("Thread was cancelled.");
        print(isThreadCancelled(t) ? "ok" : "what?");
      } else
        print("Message: " + msg);
    }
  });
  cancelThread(t);
  assertFalse(isThreadCancelled(currentThread()));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1004559
Snippet name: Test setDefaultUncaughtExceptionHandler [WORKS! :)]
Eternal ID of this version: #1004559/1
Text MD5: 0cbb9a91365ed927729383e177be0d73
Transpilation MD5: a10b9106f2451009e1e92cbcfd4a792b
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-21 15:05:20
Source code size: 590 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 590 / 675
Referenced in: