[jira] [Commented] (QPIDJMS-313) Message#getBody does not throw when attempting to read a BytesMessage as String.class

2017-08-09 Thread Jiri Danek (JIRA)

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

Jiri Danek commented on QPIDJMS-313:


Agreed. I've reported that as ARTEMIS-1341.

> 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, 0.24.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



[jira] [Commented] (QPIDJMS-313) Message#getBody does not throw when attempting to read a BytesMessage as String.class

2017-08-09 Thread Timothy Bish (JIRA)

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

Timothy Bish commented on QPIDJMS-313:
--

Give the initial source of the test I'd assert that the Artemis JMS client is 
probably in violation of the spec if it is throwing the exception when there is 
no body. 

> 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, 0.24.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



[jira] [Commented] (QPIDJMS-313) Message#getBody does not throw when attempting to read a BytesMessage as String.class

2017-08-09 Thread Jiri Danek (JIRA)

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

Jiri Danek commented on QPIDJMS-313:


Oh, I haven't read the whole document. Thanks.

> 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, 0.24.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



[jira] [Commented] (QPIDJMS-313) Message#getBody does not throw when attempting to read a BytesMessage as String.class

2017-08-09 Thread Timothy Bish (JIRA)

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

Timothy Bish commented on QPIDJMS-313:
--

Ah, so then your assumption of the result is incorrect then, if you read the 
Message API you will see that the bullet point below the one you quoted says:

{quote}
f the message is a TextMessage, ObjectMessage, MapMessage or BytesMessage and 
the message has no body, then the above does not apply and this parameter may 
be set to any type; the returned value will always be null.
{quote}

> 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



[jira] [Commented] (QPIDJMS-313) Message#getBody does not throw when attempting to read a BytesMessage as String.class

2017-08-09 Thread Jiri Danek (JIRA)

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

Jiri Danek commented on QPIDJMS-313:


Thanks for investigating. The difference between what I have and what the Qpid 
JMS test suite has is essentially this

{code}
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java
index d56c533c..330f1208 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsBytesMessageTest.java
@@ -968,8 +968,6 @@ public class JmsBytesMessageTest {
 public void testGetBodyThrowsMessageFormatException() throws JMSException {
 JmsBytesMessage bytesMessage = factory.createBytesMessage();
 bytesMessage.setStringProperty("property", "value");
-bytesMessage.writeByte((byte) 1);
-bytesMessage.writeInt(22);
 
 try {
 bytesMessage.getBody(StringBuffer.class);
{code}

If I remove the two lines (do not set any content of the message) then the Qpid 
JMS suite starts failing.

> 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



[jira] [Commented] (QPIDJMS-313) Message#getBody does not throw when attempting to read a BytesMessage as String.class

2017-08-09 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on QPIDJMS-313:
-

Commit ab5f463366acf2547725b0043003d8b8168f46bf in qpid-jms's branch 
refs/heads/master from [~tabish121]
[ https://git-wip-us.apache.org/repos/asf?p=qpid-jms.git;h=ab5f463 ]

QPIDJMS-313 Add some additional tests to show the issue is not valid

Add a few more tests that check in different contexts that the getBody
method does throw when expected.

> 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