You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Aidan Skinner (JIRA)" <qp...@incubator.apache.org> on 2008/07/25 17:19:31 UTC
[jira] Created: (QPID-1199) Can't append to BytesMessage after send
Can't append to BytesMessage after send
---------------------------------------
Key: QPID-1199
URL: https://issues.apache.org/jira/browse/QPID-1199
Project: Qpid
Issue Type: Bug
Components: Java Client
Affects Versions: M2.1, M3
Reporter: Aidan Skinner
Assignee: Aidan Skinner
Fix For: M4
The following code throws an exception on the second iteration of the loop:
public void testModificationAfterSend() throws Exception
{
Connection connection = getConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
BytesMessage jmsMsg = session.createBytesMessage();
Destination destination = new AMQQueue("amq.direct", randomize("BytesMessageTest"));
/** Set the constant message contents. */
jmsMsg.setStringProperty(
"foo", "test"
);
/** Pre-populate the message body buffer to the target size. */
byte[] jmsMsgBodyBuffer = new byte[1024];
for(int i=0;i<jmsMsgBodyBuffer.length;i++)
{
jmsMsgBodyBuffer[i] = (byte) 0xF;
}
/**
* Send messages.
*/
MessageProducer producer = session.createProducer(destination);
for(int writtenMsgCount = 0; writtenMsgCount < 10; writtenMsgCount++){
/** Set the per send message contents. */
jmsMsgBodyBuffer[0] = (byte) writtenMsgCount;
jmsMsg.writeBytes(jmsMsgBodyBuffer,0,jmsMsgBodyBuffer.length);
/** Try to write a message. */
producer.send(jmsMsg);
}
}
AFAICT there is no reason for us to not allow this to work (although it's a bit odd)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (QPID-1199) Can't append to BytesMessage after
send
Posted by "Marnie McCormack (JIRA)" <qp...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/QPID-1199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661197#action_12661197 ]
Marnie McCormack commented on QPID-1199:
----------------------------------------
Having read the JMS API on BytesMessage my reading is that the MessageConverter class should not reset the original message (applicable for BytesMessage and StreamMessage) before returning a new message for sending by the Messageproducer.
The original message should be mutable i.e. in the example above jmsMsg.writeBytes should succeed. This fails because of the reset call in MessageConverter (Lines 51 & 111).
Note that the received message should be immutable i.e. we should reset the bytes/stream in the message in receipt - have not check what we do here.
> Can't append to BytesMessage after send
> ---------------------------------------
>
> Key: QPID-1199
> URL: https://issues.apache.org/jira/browse/QPID-1199
> Project: Qpid
> Issue Type: Improvement
> Components: Java Client
> Affects Versions: M2.1, M3
> Reporter: Aidan Skinner
> Assignee: Aidan Skinner
> Priority: Minor
>
> The following code throws an exception on the second iteration of the loop:
> public void testModificationAfterSend() throws Exception
> {
> Connection connection = getConnection();
> Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> BytesMessage jmsMsg = session.createBytesMessage();
> Destination destination = new AMQQueue("amq.direct", randomize("BytesMessageTest"));
> /** Set the constant message contents. */
> jmsMsg.setStringProperty(
> "foo", "test"
> );
> /** Pre-populate the message body buffer to the target size. */
> byte[] jmsMsgBodyBuffer = new byte[1024];
> for(int i=0;i<jmsMsgBodyBuffer.length;i++)
> {
> jmsMsgBodyBuffer[i] = (byte) 0xF;
> }
> /**
> * Send messages.
> */
> MessageProducer producer = session.createProducer(destination);
> for(int writtenMsgCount = 0; writtenMsgCount < 10; writtenMsgCount++){
> /** Set the per send message contents. */
> jmsMsgBodyBuffer[0] = (byte) writtenMsgCount;
> jmsMsg.writeBytes(jmsMsgBodyBuffer,0,jmsMsgBodyBuffer.length);
> /** Try to write a message. */
> producer.send(jmsMsg);
> }
> }
> AFAICT there is no reason for us to not allow this to work (although it's a bit odd)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (QPID-1199) Can't append to BytesMessage after send
Posted by "Aidan Skinner (JIRA)" <qp...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/QPID-1199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aidan Skinner updated QPID-1199:
--------------------------------
Priority: Minor (was: Major)
Issue Type: Improvement (was: Bug)
> Can't append to BytesMessage after send
> ---------------------------------------
>
> Key: QPID-1199
> URL: https://issues.apache.org/jira/browse/QPID-1199
> Project: Qpid
> Issue Type: Improvement
> Components: Java Client
> Affects Versions: M2.1, M3
> Reporter: Aidan Skinner
> Assignee: Aidan Skinner
> Priority: Minor
> Fix For: M4
>
>
> The following code throws an exception on the second iteration of the loop:
> public void testModificationAfterSend() throws Exception
> {
> Connection connection = getConnection();
> Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> BytesMessage jmsMsg = session.createBytesMessage();
> Destination destination = new AMQQueue("amq.direct", randomize("BytesMessageTest"));
> /** Set the constant message contents. */
> jmsMsg.setStringProperty(
> "foo", "test"
> );
> /** Pre-populate the message body buffer to the target size. */
> byte[] jmsMsgBodyBuffer = new byte[1024];
> for(int i=0;i<jmsMsgBodyBuffer.length;i++)
> {
> jmsMsgBodyBuffer[i] = (byte) 0xF;
> }
> /**
> * Send messages.
> */
> MessageProducer producer = session.createProducer(destination);
> for(int writtenMsgCount = 0; writtenMsgCount < 10; writtenMsgCount++){
> /** Set the per send message contents. */
> jmsMsgBodyBuffer[0] = (byte) writtenMsgCount;
> jmsMsg.writeBytes(jmsMsgBodyBuffer,0,jmsMsgBodyBuffer.length);
> /** Try to write a message. */
> producer.send(jmsMsg);
> }
> }
> AFAICT there is no reason for us to not allow this to work (although it's a bit odd)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (QPID-1199) Can't append to BytesMessage after send
Posted by "Marnie McCormack (JIRA)" <qp...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/QPID-1199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marnie McCormack updated QPID-1199:
-----------------------------------
Fix Version/s: (was: M4)
Moving items not being worked on for M4 afaik out of scope
> Can't append to BytesMessage after send
> ---------------------------------------
>
> Key: QPID-1199
> URL: https://issues.apache.org/jira/browse/QPID-1199
> Project: Qpid
> Issue Type: Improvement
> Components: Java Client
> Affects Versions: M2.1, M3
> Reporter: Aidan Skinner
> Assignee: Aidan Skinner
> Priority: Minor
>
> The following code throws an exception on the second iteration of the loop:
> public void testModificationAfterSend() throws Exception
> {
> Connection connection = getConnection();
> Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> BytesMessage jmsMsg = session.createBytesMessage();
> Destination destination = new AMQQueue("amq.direct", randomize("BytesMessageTest"));
> /** Set the constant message contents. */
> jmsMsg.setStringProperty(
> "foo", "test"
> );
> /** Pre-populate the message body buffer to the target size. */
> byte[] jmsMsgBodyBuffer = new byte[1024];
> for(int i=0;i<jmsMsgBodyBuffer.length;i++)
> {
> jmsMsgBodyBuffer[i] = (byte) 0xF;
> }
> /**
> * Send messages.
> */
> MessageProducer producer = session.createProducer(destination);
> for(int writtenMsgCount = 0; writtenMsgCount < 10; writtenMsgCount++){
> /** Set the per send message contents. */
> jmsMsgBodyBuffer[0] = (byte) writtenMsgCount;
> jmsMsg.writeBytes(jmsMsgBodyBuffer,0,jmsMsgBodyBuffer.length);
> /** Try to write a message. */
> producer.send(jmsMsg);
> }
> }
> AFAICT there is no reason for us to not allow this to work (although it's a bit odd)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.