Example usage for java.lang Throwable getClass

List of usage examples for java.lang Throwable getClass

Introduction

In this page you can find the example usage for java.lang Throwable getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.strandls.alchemy.rest.client.exception.ExceptionPayload.java

/**
 * @param exceptionClassFQN//from ww w  .j  ava 2 s.  c  o  m
 * @param exception
 */
public ExceptionPayload(final Throwable exception) {
    this.exceptionClassFQN = exception.getClass().getName();
    this.exception = exception;
    this.exceptionMessage = exception.getMessage();
}

From source file:com.payu.ratel.proxy.RetryPolicyInvocationHandler.java

private boolean isInStacktrace(Throwable stackTrace, Class target) {
    Throwable t = stackTrace;
    while (t != null) {
        if (t.getClass().equals(target)) {
            return true;
        }// ww w.  j  av  a  2 s .c  o  m

        t = t.getCause();
    }

    return false;
}

From source file:de.kaiserpfalzEdv.vaadin.i18n.I18nInterceptor.java

@Around("defaultSetCaption() || labelSetValue()")
public Object doTranslation(final ProceedingJoinPoint invocation) {
    LOG.trace("Checking translations for {} ...", invocation.getSignature().getName());
    Object result = null;/* w  ww .  j av  a2  s .  co m*/

    Object[] args = invocation.getArgs();
    args[0] = translate((String) args[0], UI.getCurrent().getLocale());

    try {
        result = invocation.proceed(args);
    } catch (Throwable throwable) {
        LOG.error(throwable.getClass().getSimpleName() + " caught: " + throwable.getMessage(), throwable);
    }

    return result;
}

From source file:com.xidu.framework.common.util.ObjectUtils.java

/**
 * Check whether the given exception is compatible with the exceptions
 * declared in a throws clause./*from w w w .j a  v a 2  s  . c  o m*/
 * 
 * @param ex
 *            the exception to checked
 * @param declaredExceptions
 *            the exceptions declared in the throws clause
 * @return whether the given exception is compatible
 */
@SuppressWarnings("unchecked")
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class[] declaredExceptions) {
    if (!isCheckedException(ex)) {
        return true;
    }
    if (declaredExceptions != null) {
        for (int i = 0; i < declaredExceptions.length; i++) {
            if (declaredExceptions[i].isAssignableFrom(ex.getClass())) {
                return true;
            }
        }
    }
    return false;
}

From source file:com.github.lynxdb.server.api.http.ErrorResponse.java

private void parseException(Throwable _thrw, StringBuilder _builder) {
    _builder.append(_thrw.getClass().getName()).append(": ").append(_thrw.getMessage());
    for (StackTraceElement ste : _thrw.getStackTrace()) {
        _builder.append("\t").append(ste.toString()).append("\n");
    }// ww w. j a v  a 2 s  .  c  om
    if (_thrw.getCause() != null) {
        _builder.append("Caused by :");
        parseException(_thrw.getCause(), _builder);
    }
}

From source file:ar.com.zauber.commons.exception.interceptors.ErrorLog.java

/**
 * @param ex la excepcion que origina el log
 *///from   w  w  w  .  ja  v a 2s.  c o  m
public ErrorLog(final Throwable ex) {
    this.exceptionClass = ex.getClass().getName();
    String msg = ex.getMessage();
    if (msg != null && msg.length() > 250) {
        msg = msg.substring(0, 249);
    }
    this.exceptionMessage = msg;
    this.stackTrace = ExceptionUtils.getStackTrace(ex);
}

From source file:ch.algotrader.vo.LogEventVO.java

public LogEventVO(final String priority, final String eventMessage, final Throwable throwable) {
    this(priority, eventMessage, throwable != null ? throwable.getClass() : null,
            throwable != null ? throwable.getMessage() : null);
}

From source file:com.haulmont.cuba.gui.exception.MssqlDateOutOfRangeExceptionHandler.java

@Override
@SuppressWarnings("unchecked")
public boolean handle(Throwable exception, WindowManager windowManager) {
    List<Throwable> list = ExceptionUtils.getThrowableList(exception);
    for (Throwable throwable : list) {
        if (className.contains(throwable.getClass().getName())
                && isDateOutOfRangeMessage(throwable.getMessage())) {
            doHandle(windowManager);/*from  www. j av  a2  s. c om*/
            return true;
        }
        if (throwable instanceof RemoteException) {
            RemoteException remoteException = (RemoteException) throwable;
            for (RemoteException.Cause cause : remoteException.getCauses()) {
                if (className.contains(cause.getClassName())
                        && isDateOutOfRangeMessage(throwable.getMessage())) {
                    doHandle(windowManager);
                    return true;
                }
            }
        }
    }
    return false;
}

From source file:org.cloudfoundry.identity.uaa.scim.job.ItemWriterSkipListener.java

@Override
public void onSkipInWrite(S item, Throwable t) {
    logger.debug("Skipping: " + item + "(" + t.getClass().getName() + ", " + t.getMessage() + ")");
    List<S> items = Collections.singletonList(item);
    try {/*from   w  w w  . ja  v  a2  s. c  o m*/
        classifier.classify(t).write(items);
    } catch (Exception e) {
        try {
            classifier.getDefault().write(items);
        } catch (Exception ex) {
            // ignore
            logger.error("Could not register failed item", ex);
        }
    }
}

From source file:org.zalando.jpa.validation.ConstraintViolationExceptionLogger.java

@Override
public DataAccessException translateExceptionIfPossible(final RuntimeException ex) {
    Throwable[] suppressedExceptions = ex.getSuppressed();
    for (Throwable t : suppressedExceptions) {
        LOG.warn("SUPPRESSED EXCEPTION --> : {} ", t.getClass().getName());
    }//from   w  w w.  j  a v a  2s .c o m

    if (ex instanceof ConstraintViolationException) {
        violationPrinter.printValidationErrors((ConstraintViolationException) ex);
    }

    return null;
}