code: public List<Throwable> getCauses(Throwable t)
      {
          List<Throwable> causes = new LinkedList<Throwable>();
          Throwable next = t;
          while (next.getCause() != null)
          {
              next = next.getCause();
              causes.add(next);
          }
          return causes;
      }
docs: Convert a Throwable into a list containing all of its causes.
  @param t The throwable for which the causes are to be returned.
  @return A (possibly empty) list of {@link Throwable}s.