Example usage for javax.jms JMSException setLinkedException

List of usage examples for javax.jms JMSException setLinkedException

Introduction

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

Prototype

public void setLinkedException(Exception ex) 

Source Link

Document

Adds a linked Exception .

Usage

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Writes a <code>short</code> to the bytes message stream as two bytes, high byte first.
 *
 * @param value the <code>short</code> to be written
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 *///from  w  ww.j  a v  a2  s  .  c om
public void writeShort(short value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeShort(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Writes a <code>char</code> to the bytes message stream as a 2-byte value, high byte first.
 *
 * @param value the <code>char</code> value to be written
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 *///w  w w  .  j  a  v  a 2s  .  c om
public void writeChar(char value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeChar(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Writes an <code>int</code> to the bytes message stream as four bytes, high byte first.
 *
 * @param value the <code>int</code> to be written
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 *///w  w w.  j  a  v a 2  s  .  c  o m
public void writeInt(int value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeInt(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Writes a <code>long</code> to the bytes message stream as eight bytes, high byte first.
 *
 * @param value the <code>long</code> to be written
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 *//* w ww  .  j av a  2  s  .  co  m*/
public void writeLong(long value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeLong(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Converts the <code>float</code> argument to an <code>int</code> using the <code>floatToIntBits</code>
 * method in class <code>Float</code>, and then writes that <code>int</code> value to the bytes message stream
 * as a 4-byte quantity, high byte first.
 *
 * @param value the <code>float</code> value to be written
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 *///  w ww  . j a  v  a 2  s. com
public void writeFloat(float value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeFloat(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Converts the <code>double</code> argument to a <code>long</code> using the <code>doubleToLongBits</code>
 * method in class <code>Double</code>, and then writes that <code>long</code> value to the bytes message
 * stream as an 8-byte quantity, high byte first.
 *
 * @param value the <code>double</code> value to be written
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 *//*from   w w w  . ja va  2  s .c  om*/
public void writeDouble(double value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeDouble(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Writes a string to the bytes message stream using UTF-8 encoding in a machine-independent manner.
 * <P>/*from w  w  w . java  2s  .c  o  m*/
 * For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open
 * Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC
 * 10646, Annex P.
 *
 * @param value the <code>String</code> value to be written
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 */
public void writeUTF(String value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeUTF(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Writes a byte array to the bytes message stream.
 *
 * @param value the byte array to be written
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 *///from   w w  w  . ja  v a2 s  . com
public void writeBytes(byte[] value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.write(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoBytesMessage.java

/**
 * Writes a portion of a byte array to the bytes message stream.
 *
 * @param value  the byte array value to be written
 * @param offset the initial offset within the byte array
 * @param length the number of bytes to use
 * @throws JMSException                 if the JMS provider fails to write the message due to some internal error.
 * @throws MessageNotWriteableException if the message is in read-only mode.
 *///from ww w. ja v a2  s .com
public void writeBytes(byte[] value, int offset, int length) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.write(value, offset, length);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

From source file:org.skyscreamer.nevado.jms.message.NevadoStreamMessage.java

/**
 * Reads a <code>byte</code> value from the stream message.
 *
 * @return the next byte from the stream message as a 8-bit
 *         <code>byte</code>
 * @throws JMSException//  w  ww  .j a  v  a 2  s  . co  m
 *             if the JMS provider fails to read the message due to some
 *             internal error.
 * @throws MessageEOFException
 *             if unexpected end of message stream has been reached.
 * @throws MessageFormatException
 *             if this type conversion is invalid.
 * @throws javax.jms.MessageNotReadableException
 *             if the message is in write-only mode.
 */

public byte readByte() throws JMSException {
    initializeReading();
    try {

        this.dataIn.mark(10);
        int type = this.dataIn.read();
        if (type == -1) {
            throw new MessageEOFException("reached end of data");
        }
        if (type == MarshallingSupport.BYTE_TYPE) {
            return this.dataIn.readByte();
        }
        if (type == MarshallingSupport.STRING_TYPE) {
            return Byte.valueOf(this.dataIn.readUTF()).byteValue();
        }
        if (type == MarshallingSupport.NULL) {
            this.dataIn.reset();
            throw new NullPointerException("Cannot convert NULL value to byte.");
        } else {
            this.dataIn.reset();
            throw new MessageFormatException(" not a byte type");
        }
    } catch (NumberFormatException mfe) {
        try {
            this.dataIn.reset();
        } catch (IOException ioe) {
            JMSException jmsEx = new MessageFormatException(ioe.getMessage());
            jmsEx.setLinkedException(ioe);
            throw jmsEx;
        }
        throw mfe;
    } catch (EOFException e) {
        String exMessage = "Reached premature EOF: " + e.getMessage();
        _log.error(exMessage, e);
        throw new JMSException(exMessage);
    } catch (IOException e) {
        String exMessage = "Could not read boolean: " + e.getMessage();
        _log.error(exMessage, e);
        throw new JMSException(exMessage);
    }
}