public static MessageFormatException createMessageFormatException(Exception cause) { String msg = cause.getMessage(); if (msg == null || msg.length() == 0) { msg = cause.toString(); } MessageFormatException exception = new MessageFormatException(msg); exception.setLinkedException(cause); exception.initCause(cause); return exception; } }
public static MessageFormatException createMessageFormatException(Exception cause) { String msg = cause.getMessage(); if (msg == null || msg.length() == 0) { msg = cause.toString(); } MessageFormatException exception = new MessageFormatException(msg); exception.setLinkedException(cause); exception.initCause(cause); return exception; } }
public static MessageFormatException createMessageFormatException(Exception cause) { String msg = cause.getMessage(); if (msg == null || msg.length() == 0) { msg = cause.toString(); } MessageFormatException exception = new MessageFormatException(msg); exception.setLinkedException(cause); exception.initCause(cause); return exception; } }
public static MessageFormatException createMessageFormatException(Exception cause) { String msg = cause.getMessage(); if (msg == null || msg.length() == 0) { msg = cause.toString(); } MessageFormatException exception = new MessageFormatException(msg); exception.setLinkedException(cause); exception.initCause(cause); return exception; } }
public static MessageFormatException createMessageFormatException(Exception cause) { String msg = cause.getMessage(); if (msg == null || msg.length() == 0) { msg = cause.toString(); } MessageFormatException exception = new MessageFormatException(msg); exception.setLinkedException(cause); exception.initCause(cause); return exception; }
public static MessageFormatException createMessageFormatException(Exception cause) { String msg = cause.getMessage(); if (msg == null || msg.length() == 0) { msg = cause.toString(); } MessageFormatException exception = new MessageFormatException(msg); exception.setLinkedException(cause); exception.initCause(cause); return exception; } }
/** * Instantiates a <code>BytesMessage</code> wrapping a consumed * MOM message containing a bytes array. * * @param sess The consuming session. * @param momMsg The MOM message to wrap. * @throws IOException if an I/O error has occurred */ BytesMessage(Session sess, org.objectweb.joram.shared.messages.Message momMsg) throws JMSException { super(sess, momMsg); try { inputStream = new DataInputStream(new ByteArrayInputStream(momMsg.getBody())); } catch (IOException exc) { MessageFormatException jExc = new MessageFormatException("The message body could not be uncompressed."); jExc.setLinkedException(exc); throw jExc; } }
/** * 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; }
/** * Method actually preparing the message for sending by transfering the * local body into the wrapped MOM message. * * @exception MessageFormatException If an error occurs while serializing. */ protected void prepare() throws JMSException { super.prepare(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(map); oos.flush(); momMsg.setBody(baos.toByteArray()); oos.close(); baos.close(); } catch (IOException exc) { MessageFormatException jExc = new MessageFormatException("The message body could not be serialized."); jExc.setLinkedException(exc); throw jExc; } }
/** * 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; }
MessageFormatException jE = new MessageFormatException("Error while getting the body."); jE.setLinkedException(exc); throw jE; } finally {
/** * Method actually preparing the message for sending by transfering the * local body into the wrapped MOM message. * * @exception MessageFormatException If an error occurs while serializing. */ protected void prepare() throws JMSException { super.prepare(); try { if (! RObody) { outputStream.flush(); momMsg.setBody(outputBuffer.toByteArray()); prepared = true; } } catch (IOException exc) { MessageFormatException jExc = new MessageFormatException("The message body could not be serialized."); jExc.setLinkedException(exc); throw jExc; } }
/** * Method actually preparing the message for sending by transferring the * local body into the wrapped MOM message. * * @exception MessageFormatException If an error occurs while serializing. */ protected void prepare() throws JMSException { super.prepare(); try { if (! RObody) { outputStream.flush(); momMsg.setBody(outputBuffer.toByteArray()); prepared = true; } } catch (IOException exc) { MessageFormatException jExc = new MessageFormatException("The message body could not be serialized."); jExc.setLinkedException(exc); throw jExc; } } }
} catch (JMSException jE) { MessageFormatException mE = new MessageFormatException("Message to send is invalid."); mE.setLinkedException(jE); throw mE;