code: @GwtIncompatible("incompatible method")
      public static void printRootCauseStackTrace(final Throwable throwable, final PrintWriter writer) {
          if (throwable == null) {
              return;
          }
          Validate.isTrue(writer != null, "The PrintWriter must not be null");
          final String trace[] = getRootCauseStackTrace(throwable);
          for (final String element : trace) {
              writer.println(element);
          }
          writer.flush();
      }
docs: <p>Prints a compact stack trace for the root cause of a throwable.</p>
  
  <p>The compact stack trace starts with the root cause and prints
  stack frames up to the place where it was caught and wrapped.
  Then it prints the wrapped exception and continues with stack frames
  until the wrapper exception is caught and wrapped again, etc.</p>
  
  <p>The output of this method is consistent across JDK versions.
  Note that this is the opposite order to the JDK1.4 display.</p>
  
  <p>The method is equivalent to <code>printStackTrace</code> for throwables
  that don't have nested causes.</p>
  
  @param throwable  the throwable to output, may be null
  @param writer  the writer to output to, may not be null
  @throws IllegalArgumentException if the writer is <code>null</code>
  @since 2.0