[ 
https://issues.apache.org/jira/browse/QPIDJMS-313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Timothy Bish closed QPIDJMS-313.
--------------------------------
    Resolution: Not A Problem

This is already tested to work but I've added a few other variations that show 
it works in the client test suite.  I'd recommend checking your tests.  If you 
can supply a reproducer test for the Qpid JMS suite feel free to reopen. 

> Message#getBody does not throw when attempting to read a BytesMessage as 
> String.class
> -------------------------------------------------------------------------------------
>
>                 Key: QPIDJMS-313
>                 URL: https://issues.apache.org/jira/browse/QPIDJMS-313
>             Project: Qpid JMS
>          Issue Type: Bug
>          Components: qpid-jms-client
>    Affects Versions: 0.23.0
>            Reporter: Jiri Danek
>            Priority: Minor
>
> Consider the ActiveMQ Artemis test 
> {{org.apache.activemq.artemis.tests.integration.jms.jms2client.BodyTest#testBodyConversion}}
>  adapted to run through multiple JMS ConnectionFactories in turn. This test 
> passes with Core JMS client, is skipped (or should be skipped) with ActiveMQ 
> OpenWire client (that is a JMS 1.1 client) and fails with qpid-jms client.
> {noformat}
>          BytesMessage bytesMessage = sess.createBytesMessage();
>          producer.send(bytesMessage);
>          Message msg = cons.receiveNoWait();
>          assertNotNull(msg);
>          try {
>             msg.getBody(String.class);
>             fail("Exception expected");
>          } catch (MessageFormatException e) {
>          }
> {noformat}
> The failing line is the {{fail("Exception expected");}}, because qpid-jms 
> does not throw {{MessageFormatException}} where it is supposed to.
> According to https://docs.oracle.com/javaee/7/api/javax/jms/Message.html. "If 
> the message is a BytesMessage then this parameter must be set to byte[].class 
> (or java.lang.Object.class). This method will reset the BytesMessage before 
> and after use." ... "Throws: MessageFormatException" ... "if the message body 
> cannot be assigned to the specified type."



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to