Java Utililty Methods Error Print

List of utility methods to do Error Print

Description

The list of methods to do Error Print are organized into topic(s).

Method

voidprintErrorFooter(String content)
print Error Footer
System.out.println("");
System.out.println("+---------------------------------------------------------+");
System.out.println("| " + content);
System.out.println("+---------------------------------------------------------+");
StringprintErrorInfo(Object e)
print Error Info
String causeText;
if (e instanceof Throwable) {
    ((Throwable) e).printStackTrace();
    causeText = e.toString();
} else {
    causeText = e.toString();
System.err.println("ErrorInfo: " + causeText);
...
voidprintErrorLine()
print Error Line
System.err.println(" at " + Thread.currentThread().getStackTrace()[2]);
voidprintErrorln(String string)
print Errorln
if (progressLine) {
    if (disableFancy) {
        if (progressLineUsed) {
            System.out.println();
            printsSinceReturn = 0;
    } else {
        System.out.print("\r \r");
...
voidprintErrorMessage(final String prg_name, final String message)
print Error Message
System.out.println("[" + prg_name + "] > error: " + message);
voidprintErrorMessage(String errorMessage)
Print the error message if it is not null and empty string.
if (errorMessage != null && !errorMessage.trim().equals("")) {
    System.out.println("Error Message: " + errorMessage);
voidprintErrorMsgTraceAsCause(Throwable throwable, StackTraceElement[] causedTrace)
Print error msg trace as cause.
StackTraceElement[] trace = throwable.getStackTrace();
int m = trace.length - 1, n = causedTrace.length - 1;
while (m >= 0 && n >= 0 && trace[m].equals(causedTrace[n])) {
    m--;
    n--;
int framesInCommon = trace.length - 1 - m;
System.err.println(new StringBuffer().append("\t\t\t\tCaused by: ").append(throwable).toString());
...