code: private static void printStackTraceCause(Throwable cause, Locale locale, Appendable buffer) throws IOException {
  
      if (cause instanceof NlsThrowable) {
        ((NlsThrowable) cause).printStackTrace(locale, buffer);
      } else {
        if (buffer instanceof PrintStream) {
          cause.printStackTrace((PrintStream) buffer);
        } else if (buffer instanceof PrintWriter) {
          cause.printStackTrace((PrintWriter) buffer);
        } else {
          StringWriter writer = new StringWriter();
          PrintWriter printWriter = new PrintWriter(writer);
          cause.printStackTrace(printWriter);
          printWriter.flush();
          buffer.append(writer.toString());
        }
      }
    }
docs: @see NlsThrowable#printStackTrace(Locale, Appendable)
  
  @param cause is the {@link Throwable} to print.
  @param locale is the {@link Locale} to translate to.
  @param buffer is where to write the stack trace to.
  @throws IOException if caused by {@code buffer}.