public void check() throws Exception {
      if (firstException != null) {
        throw new Exception("Thread failed", firstException);
      }
    }
Exception handler for uncaught exceptions in a thread.

<p>TODO(bleichen): Surely there must be a better way to catch exceptions in threads in unit
tests. junit ought to do this. However, at least for some setups, tests can pass despite
uncaught exceptions in threads.
java_src/src/test/java/com/google/crypto/tink/subtle/AeadThreadSafetyTest.java