Java SQLException getClassWhichThrowsException(SQLException e)

Here you can find the source of getClassWhichThrowsException(SQLException e)

Description

get Class Which Throws Exception

License

Open Source License

Declaration

public static String getClassWhichThrowsException(SQLException e) 

Method Source Code


//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 "";
    }
}

Related

  1. extractSqlStateClassCode(SQLException sqlException)
  2. getAllMessages(Throwable t, boolean includeExceptionName)
  3. getAllMessagesArray(Throwable t, boolean includeExceptionName)
  4. getAllSqlExceptionMessages(SQLException t)
  5. getAllSqlExceptionMessagesArray(SQLException t, boolean includeExceptionName)
  6. getExceptionCause(Throwable e)
  7. getExceptionMessage(Throwable t)
  8. getFullMessage(SQLException exception)
  9. getNextExceptionFromLastCause(Exception e)