package som;

import java.lang.Thread.UncaughtExceptionHandler;

import tools.concurrency.TracingActivityThread;


/**
 * In case an actor processing thread terminates, provide some info.
 */
public final class UncaughtExceptions implements UncaughtExceptionHandler {

  private final VM vm;

  public UncaughtExceptions(final VM vm) {
    this.vm = vm;
  }

  @Override
  public void uncaughtException(final Thread t, final Throwable e) {
    if (e instanceof ThreadDeath) {
      // Ignore those, we already signaled an error
      return;
    }
    TracingActivityThread thread = (TracingActivityThread) t;
    Output.errorPrintln("Processing failed for: "
        + thread.getActivity().toString());
    e.printStackTrace();

    vm.requestExit(2);
  }
}

@@ -541,16 +541,83 @@
 ;%0A    %7D%0A
+%0A    Output.errorPrintln(%22Uncaught exception on %22 + t.getName());%0A%0A
     Trac
@@ -670,16 +670,58 @@
 ead) t;%0A
+    if (thread.getActivity() != null) %7B%0A  
     Outp
@@ -770,16 +770,18 @@
         
+  
 + thread
@@ -808,16 +808,22 @@
 ing());%0A
+    %7D%0A
     e.pr

Fix NPE in uncaught exception handler, and add info on thread