You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Gordon Sim <gs...@redhat.com> on 2006/09/11 09:43:20 UTC
[java] Re: Bug: BytesMessage.reset() throws MessageNotWriteableException
Apologies for slow reply, was out of the office for a couple of days...
Martin Ritchie wrote:
> I'm sure flip() is correct and all that need be done is remove the
> checkWritable() call. It would be good if someone (I guess Robert or
> Gordon) more familiar with this bit of code could OK this change.
I believe the idea behind the current code is that reset() gets called
to make a writable message readable. Whether this is required or not I
can't say for sure, but as pointed out at the start of this thread it
should allow users to invoke it multiple times once the message is
readable though.
> public void reset() throws JMSException
> {
> //checkWritable();
> _data.flip();
> _readable = true;
> }
I think we still want to check whether the message is writable, and if
it is call _data.flip(), if it isn't call _data.rewind(). i.e. along the
lines of:
if(_readable){
_data.rewind();
}else{
_data.flip();
_readable = true;
}
RE: [java] Re: Bug: BytesMessage.reset() throws MessageNotWriteableException
Posted by Colin Crist <co...@hermesjms.com>.
Hi,
The suggested fix works with at least some limited testing in HermesJMS.
Regards,
Colin.
http://hermesjms.com
-----Original Message-----
From: Gordon Sim [mailto:gsim@redhat.com]
Sent: 11 September 2006 08:43
To: qpid-dev@incubator.apache.org
Subject: [java] Re: Bug: BytesMessage.reset() throws
MessageNotWriteableException
Apologies for slow reply, was out of the office for a couple of days...
Martin Ritchie wrote:
> I'm sure flip() is correct and all that need be done is remove the
> checkWritable() call. It would be good if someone (I guess Robert or
> Gordon) more familiar with this bit of code could OK this change.
I believe the idea behind the current code is that reset() gets called to
make a writable message readable. Whether this is required or not I can't
say for sure, but as pointed out at the start of this thread it should allow
users to invoke it multiple times once the message is readable though.
> public void reset() throws JMSException
> {
> //checkWritable();
> _data.flip();
> _readable = true;
> }
I think we still want to check whether the message is writable, and if it is
call _data.flip(), if it isn't call _data.rewind(). i.e. along the lines of:
if(_readable){
_data.rewind();
}else{
_data.flip();
_readable = true;
}