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

/**
 * Reads an unsigned 16-bit number from the bytes message stream.
 *
 * @return the next two bytes from the bytes message stream, interpreted as an unsigned 16-bit integer
 * @throws JMSException                if the JMS provider fails to read the message due to some internal error.
 * @throws MessageEOFException         if unexpected end of bytes stream has been reached.
 * @throws MessageNotReadableException if the message is in write-only mode.
 *///from  www.jav  a 2 s .  c o m
public int readUnsignedShort() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readUnsignedShort();
    } catch (EOFException eof) {
        JMSException jmsEx = new MessageEOFException(eof.getMessage());
        jmsEx.setLinkedException(eof);
        throw jmsEx;
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

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

/**
 * Reads a Unicode character value from the bytes message stream.
 *
 * @return the next two bytes from the bytes message stream as a Unicode character
 * @throws JMSException                if the JMS provider fails to read the message due to some internal error.
 * @throws MessageEOFException         if unexpected end of bytes stream has been reached.
 * @throws MessageNotReadableException if the message is in write-only mode.
 *//*from   w w w  .j a v  a2  s .c om*/
public char readChar() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readChar();
    } catch (EOFException eof) {
        JMSException jmsEx = new MessageEOFException(eof.getMessage());
        jmsEx.setLinkedException(eof);
        throw jmsEx;
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

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

/**
 * Reads a signed 32-bit integer from the bytes message stream.
 *
 * @return the next four bytes from the bytes message stream, interpreted as an <code>int</code>
 * @throws JMSException                if the JMS provider fails to read the message due to some internal error.
 * @throws MessageEOFException         if unexpected end of bytes stream has been reached.
 * @throws MessageNotReadableException if the message is in write-only mode.
 */// w  w  w . java  2s  . c  o m
public int readInt() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readInt();
    } catch (EOFException eof) {
        JMSException jmsEx = new MessageEOFException(eof.getMessage());
        jmsEx.setLinkedException(eof);
        throw jmsEx;
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

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

/**
 * Reads a signed 64-bit integer from the bytes message stream.
 *
 * @return the next eight bytes from the bytes message stream, interpreted as a <code>long</code>
 * @throws JMSException                if the JMS provider fails to read the message due to some internal error.
 * @throws MessageEOFException         if unexpected end of bytes stream has been reached.
 * @throws MessageNotReadableException if the message is in write-only mode.
 *//* w w w .ja v  a  2 s  .  c  om*/
public long readLong() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readLong();
    } catch (EOFException eof) {
        JMSException jmsEx = new MessageEOFException(eof.getMessage());
        jmsEx.setLinkedException(eof);
        throw jmsEx;
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

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

/**
 * Reads a <code>float</code> from the bytes message stream.
 *
 * @return the next four bytes from the bytes message stream, interpreted as a <code>float</code>
 * @throws JMSException                if the JMS provider fails to read the message due to some internal error.
 * @throws MessageEOFException         if unexpected end of bytes stream has been reached.
 * @throws MessageNotReadableException if the message is in write-only mode.
 *//*from  www  .j  a v  a 2 s.c  om*/
public float readFloat() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readFloat();
    } catch (EOFException eof) {
        JMSException jmsEx = new MessageEOFException(eof.getMessage());
        jmsEx.setLinkedException(eof);
        throw jmsEx;
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

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

/**
 * Reads a <code>double</code> from the bytes message stream.
 *
 * @return the next eight bytes from the bytes message stream, interpreted as a <code>double</code>
 * @throws JMSException                if the JMS provider fails to read the message due to some internal error.
 * @throws MessageEOFException         if unexpected end of bytes stream has been reached.
 * @throws MessageNotReadableException if the message is in write-only mode.
 *//*  w ww .j a v  a 2  s . co m*/
public double readDouble() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readDouble();
    } catch (EOFException eof) {
        JMSException jmsEx = new MessageEOFException(eof.getMessage());
        jmsEx.setLinkedException(eof);
        throw jmsEx;
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

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

/**
 * Reads a string that has been encoded using a modified UTF-8 format from the bytes message stream.
 * <P>/*ww  w. j  a v a2  s .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.
 *
 * @return a Unicode string from the bytes message stream
 * @throws JMSException                if the JMS provider fails to read the message due to some internal error.
 * @throws MessageEOFException         if unexpected end of bytes stream has been reached.
 * @throws MessageNotReadableException if the message is in write-only mode.
 */
public String readUTF() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readUTF();
    } catch (EOFException eof) {
        JMSException jmsEx = new MessageEOFException(eof.getMessage());
        jmsEx.setLinkedException(eof);
        throw jmsEx;
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

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

/**
 * Reads a portion of the bytes message stream.
 * <P>//  www  . j  av a  2 s.  c  om
 * If the length of array <code>value</code> is less than the number of bytes remaining to be read from the
 * stream, the array should be filled. A subsequent call reads the next increment, and so on.
 * <P>
 * If the number of bytes remaining in the stream is less than the length of array <code>value</code>, the bytes
 * should be read into the array. The return value of the total number of bytes read will be less than the length
 * of the array, indicating that there are no more bytes left to be read from the stream. The next read of the
 * stream returns -1.
 * <p/>
 * If <code>length</code> is negative, or <code>length</code> is greater than the length of the array <code>value</code>,
 * then an <code>IndexOutOfBoundsException</code> is thrown. No bytes will be read from the stream for this
 * exception case.
 *
 * @param value  the buffer into which the data is read
 * @param length the number of bytes to read; must be less than or equal to <code>value.length</code>
 * @return the total number of bytes read into the buffer, or -1 if there is no more data because the end of the
 *         stream has been reached
 * @throws JMSException                if the JMS provider fails to read the message due to some internal error.
 * @throws MessageNotReadableException if the message is in write-only mode.
 */
public int readBytes(byte[] value, int length) throws JMSException {
    initializeReading();
    try {
        int n = 0;
        while (n < length) {
            int count = this.dataIn.read(value, n, length - n);
            if (count < 0) {
                break;
            }
            n += count;
        }
        if (n == 0 && length > 0) {
            n = -1;
        }
        return n;
    } catch (EOFException eof) {
        JMSException jmsEx = new MessageEOFException(eof.getMessage());
        jmsEx.setLinkedException(eof);
        throw jmsEx;
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}

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

/**
 * Writes a <code>boolean</code> to the bytes message stream as a 1-byte value. The value <code>true</code> is
 * written as the value <code>(byte)1</code>; the value <code>false</code> is written as the value <code>(byte)0</code>.
 *
 * @param value the <code>boolean</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 .  j a v a  2  s  . c o m
public void writeBoolean(boolean value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeBoolean(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>byte</code> to the bytes message stream as a 1-byte value.
 *
 * @param value the <code>byte</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.
 *///  www .  j  a  v  a 2  s.co  m
public void writeByte(byte value) throws JMSException {
    initializeWriting();
    try {
        this.dataOut.writeByte(value);
    } catch (IOException ioe) {
        JMSException jmsEx = new JMSException("Could not write data:" + ioe.getMessage());
        jmsEx.setLinkedException(ioe);
        throw jmsEx;
    }
}