Java Stacktrace stackTrace(final Exception t)

Here you can find the source of stackTrace(final Exception t)

Description

Since calling Exception#printStackTrace() is considered a bad practice, we wrap all these calls with this method to prevent static code analysis from complaning.

License

Apache License

Parameter

Parameter Description
t Exception to print to System.err

Declaration

public static void stackTrace(final Exception t) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from   w  w  w. j a va 2  s. co  m*/
     * Since calling {@link Exception#printStackTrace()} is considered a bad practice, we wrap all these calls with  this
     * method to prevent static code analysis from complaning. Also allows us to change this practice in one spot.
     *
     * @param t Exception to print to {@code System.err}
     */
    public static void stackTrace(final Exception t) {
        t.printStackTrace(System.err);
    }
}

Related

  1. stackTrace()
  2. stackTrace()
  3. stackTrace()
  4. stackTrace()
  5. stacktrace()
  6. stackTrace(final Throwable caught)
  7. stackTrace(int depth)
  8. stackTrace(StackTraceElement[] stackTrace)
  9. stackTrace2String(Throwable e)