Example usage for javax.jms JMSException JMSException

List of usage examples for javax.jms JMSException JMSException

Introduction

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

Prototype

public JMSException(String reason) 

Source Link

Document

Constructs a JMSException with the specified reason and with the error code defaulting to null.

Usage

From source file:org.nuxeo.ecm.core.jms.CoreEventPublisher.java

public void publish(Serializable content, String eventId) throws JMSException {
    try {/*from w  w  w .j  a v  a 2s .co  m*/
        publish(content, getDefaultTopic(), MessageFactory.DEFAULT, eventId);
    } catch (NamingException e) {
        log.error("Failed to lookup default topic", e);
        throw new JMSException("Failed to lookup default topic");
    }
}

From source file:org.openadaptor.auxil.connector.jms.JMSConnectionTestCase.java

public void testCreateConnectionException() {
    log.debug("Running Test: CreateConnectionException");
    connectionFactoryMock.expects(once()).method("createConnection")
            .will(throwException(new JMSException("test")));

    connectionMock.expects(never()).method("createSession");
    connectionMock.expects(never()).method("start");
    sessionMock.expects(never()).method("createConsumer");

    dirContextMock.expects(once()).method("lookup").with(eq(CONNECTION_FACTORY_LOOKUP_NAME))
            .will(returnValue(connectionFactoryMock.proxy()));
    dirContextMock.expects(never()).method("lookup").with(eq(DESTINATION_NAME))
            .will(returnValue(destinationMock.proxy()));

    try {/*from  www  . j a  va  2 s. c o m*/
        testConnection.createConnection();
        fail("Expected ConnectionException not thrown.");
    } catch (ConnectionException e) {
        // expected
    } catch (Exception e) {
        fail("Unexpected exception: " + e);
    }
}

From source file:org.openadaptor.auxil.connector.jms.JMSReadConnectorTestCase.java

public void testNextJMSException() {
    setupConnectExpectations();//  w w w .  j  a v a  2s . com

    JMSException testJmsException = new JMSException("I am a test exception.");
    messageConsumerMock.expects(once()).method("receive").will(throwException(testJmsException));

    testReadConnector.connect();

    try {
        testReadConnector.next(10);
        fail("Expected ConnectionException");
    } catch (ConnectionException e) {
        log.debug("Expected ConnectionException raised." + e);
    } catch (Exception e) {
        fail("Unexpected exception: " + e);
    }
}

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

/**
 * Reads a <code>boolean</code> from the bytes message stream.
 *
 * @return the <code>boolean</code> value read
 * @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 a2 s  . c  o  m*/
public boolean readBoolean() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readBoolean();
    } 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 8-bit value from the bytes message stream.
 *
 * @return the next byte from the bytes message stream as a signed 8-bit <code>byte</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  w  w  w  .  j  a  v  a  2s  . co m*/
public byte readByte() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readByte();
    } 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 an unsigned 8-bit number from the bytes message stream.
 *
 * @return the next byte from the bytes message stream, interpreted as an unsigned 8-bit number
 * @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  a2s . c o  m*/
public int readUnsignedByte() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readUnsignedByte();
    } 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 16-bit number from the bytes message stream.
 *
 * @return the next two bytes from the bytes message stream, interpreted as a signed 16-bit number
 * @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  ww w  .  j  a  va2  s .c o m
public short readShort() throws JMSException {
    initializeReading();
    try {
        return this.dataIn.readShort();
    } 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 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.
 *//*w w w  .  ja  v a  2 s. c om*/
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   ww w  . jav  a2s.  com*/
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.
 *//*ww w . j  ava2 s .c om*/
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;
    }
}