Here you can find the source of getClassWhichThrowsException(SQLException e)
public static String getClassWhichThrowsException(SQLException e)
//package com.java2s; //License from project: Open Source License import java.sql.SQLException; public class Main { public static String getClassWhichThrowsException(SQLException e) { for (StackTraceElement element : e.getStackTrace()) { if (element.getClassName().contains("pfreiberg")) { String[] tokens = element.getClassName().split("\\."); return tokens[tokens.length - 1]; }/*from w ww. ja v a 2 s. co m*/ } return ""; } }