public static void setRootCause(Throwable exception, Throwable newRootCause) {
    Throwable nt = exception;
    while (nt.getCause() != null) {
      nt = nt.getCause();
    }

    // Don't try to set something as it's own cause
    if (nt == newRootCause) {
      return;
    }

    nt.initCause(newRootCause);
  }
Set the root cause of an exception, if possible, to be newRootCause
geode-core/src/main/java/org/apache/geode/internal/lang/ThrowableUtils.java