Java Code Examples for javax.jms.MessageFormatException#initCause()
The following examples show how to use
javax.jms.MessageFormatException#initCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsObjectMessage.java From qpid-jms with Apache License 2.0 | 5 votes |
@Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); try { this.facade.setObject(newObject); } catch (Exception e) { MessageFormatException jmsEx = new MessageFormatException("Failed to serialize object:" + e.getMessage()); jmsEx.setLinkedException(e); jmsEx.initCause(e); throw jmsEx; } }
Example 2
Source File: JmsObjectMessage.java From qpid-jms with Apache License 2.0 | 5 votes |
@Override public Serializable getObject() throws JMSException { try { return this.facade.getObject(); } catch (Exception e) { MessageFormatException jmsEx = new MessageFormatException("Failed to read object: " + e.getMessage()); jmsEx.setLinkedException(e); jmsEx.initCause(e); throw jmsEx; } }
Example 3
Source File: JmsObjectMessage.java From qpid-jms with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override protected <T> T doGetBody(Class<T> asType) throws JMSException { try { return (T) getObject(); } catch (JMSException e) { MessageFormatException jmsEx = new MessageFormatException("Failed to read object: " + e.getMessage()); jmsEx.setLinkedException(e); jmsEx.initCause(e); throw jmsEx; } }
Example 4
Source File: SQSMessage.java From amazon-sqs-java-messaging-lib with Apache License 2.0 | 4 votes |
protected static MessageFormatException convertExceptionToMessageFormatException(Exception e) { MessageFormatException ex = new MessageFormatException(e.getMessage()); ex.initCause(e); return ex; }
Example 5
Source File: JMSExceptionSupport.java From pooled-jms with Apache License 2.0 | 3 votes |
/** * Creates or passes through a MessageFormatException to be thrown to the client. * * In the event that the exception passed to this method is already a * MessageFormatException it is passed through unmodified, otherwise a new * MessageFormatException is created using the error message taken from the * given Throwable value and the cause value is set to the given Throwable * instance. * * @param cause * The exception that caused this error state. * * @return a MessageEOFException instance. */ public static MessageFormatException createMessageFormatException(Throwable cause) { String message = cause.getMessage(); if (message == null || message.length() == 0) { message = cause.toString(); } MessageFormatException exception = new MessageFormatException(message); if (cause instanceof Exception) { exception.setLinkedException((Exception) cause); } exception.initCause(cause); return exception; }
Example 6
Source File: JmsExceptionSupport.java From qpid-jms with Apache License 2.0 | 3 votes |
/** * Creates or passes through a MessageFormatException to be thrown to the client. * * In the event that the exception passed to this method is already a * MessageFormatException it is passed through unmodified, otherwise a new * MessageFormatException is created using the error message taken from the * given Throwable value and the cause value is set to the given Throwable * instance. * * @param cause * The exception that caused this error state. * * @return a MessageEOFException instance. */ public static MessageFormatException createMessageFormatException(Throwable cause) { String message = cause.getMessage(); if (message == null || message.length() == 0) { message = cause.toString(); } MessageFormatException exception = new MessageFormatException(message); if (cause instanceof Exception) { exception.setLinkedException((Exception) cause); } exception.initCause(cause); return exception; }