Example usage for java.sql SQLException equals

List of usage examples for java.sql SQLException equals

Introduction

In this page you can find the example usage for java.sql SQLException equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.seasar.dbflute.logic.replaceschema.loaddata.impl.DfXlsDataHandlerImpl.java

protected void handleWriteTableException(File file, DfDataTable dataTable // basic
        , SQLException mainEx // an exception of main process
        , SQLException retryEx, DfDataRow retryDataRow // retry
        , List<String> columnNameList) { // supplement
    final SQLException nextEx = mainEx.getNextException();
    if (nextEx != null && !mainEx.equals(nextEx)) { // focus on next exception
        _log.warn("*Failed to register the xls data: " + mainEx.getMessage()); // trace just in case
        mainEx = nextEx; // switch
    }/*from w w  w  . j  av a  2s  .  com*/
    final String tableDbName = dataTable.getTableDbName();
    final String msg = buildWriteFailureMessage(file, tableDbName, mainEx, retryEx, retryDataRow,
            columnNameList);
    throw new DfXlsDataRegistrationFailureException(msg, mainEx);
}

From source file:sos.util.SOSExceptionMessage.java

/**
 * /* w ww  .  ja va 2s . c  o  m*/
 * 
 * @param exception
 * @return
 */
public static String getExceptionMessage(Exception exception) {
    String msg = "";

    try {

        if (exception instanceof SQLException) {
            //|| exception instanceof javax.mail.MessagingException) {

            SQLException sqlExcep = (SQLException) exception;
            while (sqlExcep != null) {

                if (sqlExcep.equals(sqlExcep.getNextException())) {
                    break;
                }

                msg = sqlExcep.toString();
                if (sqlExcep.getCause() != null) {
                    msg = msg + "\n" + sqlExcep.getCause();
                }
                sqlExcep = sqlExcep.getNextException();

            }

        } else {
            msg = exception.toString();
            if (exception.getCause() != null) {
                msg = exception.toString() + " " + exception.getCause();
            }

        }
    } catch (Exception e) {
        System.out.print(e);
    }
    return msg;
}