Example usage for javax.jms JMSException getLinkedException

List of usage examples for javax.jms JMSException getLinkedException

Introduction

In this page you can find the example usage for javax.jms JMSException getLinkedException.

Prototype

public Exception getLinkedException() 

Source Link

Document

Gets the exception linked to this one.

Usage

From source file:com.adaptris.core.jms.JmsConnectionErrorHandler.java

private void handleOnException(JMSException e) {
    try {//from   w w  w  .j  a v  a2s  .  c  om
        log.error("JMS connection exception", e);
        if (e.getLinkedException() != null) {
            log.debug("JMS Linked Exception ", e.getLinkedException());
        }
        handleConnectionException();
    } catch (Exception x) {
        log.error("Unexpected Exception thrown back to onException", x);
    }
}

From source file:com.adaptris.core.jms.JmsProducerImpl.java

protected void logLinkedException(String prefix, Exception e) {
    if (!(e instanceof JMSException))
        return;//from  w ww  . j a va 2s . com
    JMSException je = (JMSException) e;
    currentLogger().warn("JMSException caught [{}], [{}]", StringUtils.defaultIfEmpty(prefix, ""),
            e.getMessage());
    if (je.getLinkedException() != null) {
        currentLogger().trace("Linked Exception available...");
        currentLogger().trace(je.getLinkedException().getMessage(), je.getLinkedException());
    } else {
        currentLogger().trace("No Linked Exception available");
    }
}

From source file:net.timewalker.ffmq4.utils.ErrorTools.java

/**
 * Log a JMS exception with an error level
 * @param e/* ww w .  j a  va  2  s .  c o  m*/
 * @param log
 */
public static void log(String context, JMSException e, Log log) {
    StringBuilder message = new StringBuilder();
    if (context != null) {
        message.append("[");
        message.append(context);
        message.append("] ");
    }
    if (e.getErrorCode() != null) {
        message.append("error={");
        message.append(e.getErrorCode());
        message.append("} ");
    }
    message.append(e.getMessage());
    log.error(message.toString());
    if (e.getLinkedException() != null)
        log.error("Linked exception was :", e.getLinkedException());
}

From source file:org.springframework.jms.support.JmsUtils.java

/**
 * Build a descriptive exception message for the given JMSException,
 * incorporating a linked exception's message if appropriate.
 * @param ex the JMSException to build a message for
 * @return the descriptive message String
 * @see javax.jms.JMSException#getLinkedException()
 *//*w  w  w . j  a v  a 2  s. c  o m*/
public static String buildExceptionMessage(JMSException ex) {
    String message = ex.getMessage();
    Exception linkedEx = ex.getLinkedException();
    if (linkedEx != null) {
        if (message == null) {
            message = linkedEx.toString();
        } else {
            String linkedMessage = linkedEx.getMessage();
            if (linkedMessage != null && !message.contains(linkedMessage)) {
                message = message + "; nested exception is " + linkedEx;
            }
        }
    }
    return message;
}