Here you can find the source of getCauseUsingWellKnownTypes(Throwable throwable)
private static Throwable getCauseUsingWellKnownTypes(Throwable throwable)
//package com.java2s; //License from project: Apache License import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; public class Main { private static Throwable getCauseUsingWellKnownTypes(Throwable throwable) { if (throwable instanceof SQLException) { return ((SQLException) throwable).getNextException(); } else if (throwable instanceof InvocationTargetException) { return ((InvocationTargetException) throwable).getTargetException(); } else {/*from w w w . ja va 2s . com*/ return null; } } }