Example usage for org.apache.commons.lang.exception ExceptionUtils getThrowableCount

List of usage examples for org.apache.commons.lang.exception ExceptionUtils getThrowableCount

Introduction

In this page you can find the example usage for org.apache.commons.lang.exception ExceptionUtils getThrowableCount.

Prototype

public static int getThrowableCount(Throwable throwable) 

Source Link

Document

Counts the number of Throwable objects in the exception chain.

A throwable without cause will return 1.

Usage

From source file:MainClass.java

public static void main(String[] args) {
    try {/*from ww  w. ja v  a2 s .  c  om*/
        a();
    } catch (Exception e) {
        System.out.println("Number of Throwable objects in the exception chain is: "
                + ExceptionUtils.getThrowableCount(e));
        e.printStackTrace();
    }
}

From source file:ExceptionTrial.java

public static void main(String[] args) {
    try {//from w ww.  ja v  a  2 s .c  om
        middleMeth();
    } catch (Exception e) {
        System.out.println("Number of Throwable objects in the exception chain is: "
                + ExceptionUtils.getThrowableCount(e));
        e.printStackTrace();
    }
}