qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject [java] Re: Bug: BytesMessage.reset() throws MessageNotWriteableException
Date Mon, 11 Sep 2006 07:43:20 GMT
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;	
}

Mime
View raw message