[jmscts-developer] [ jmscts-Bugs-879678 ] StreamMessageTest.testIncrementalReadBytes() not compliant
Status: Alpha
Brought to you by:
tanderson
From: SourceForge.net <no...@so...> - 2004-02-02 04:55:45
|
Bugs item #879678, was opened at 2004-01-19 18:33 Message generated for change (Comment added) made by tanderson You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=563359&aid=879678&group_id=81568 >Category: compliance >Group: v0.5-b1 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Daniel Bauer (dnb7) Assigned to: Tim Anderson (tanderson) >Summary: StreamMessageTest.testIncrementalReadBytes() not compliant Initial Comment: I think there's a tiny bug in StreamMessageTest.java, in the > read(StreamMessage message, Class type) method when reading byte arrays. > In this code, you loop until readBytes returns -1 and you read out > an array of size 256. I think this is wrong. The loop needs to stop also > if you receive less than 256 bytes. Here's an extract from the > JMS 1.1 API: > > ---snip--- > To read the field value, readBytes should be successively called until it > returns a value less than the length of the read buffer. The value of the > bytes in the buffer following the last byte read is undefined. > > If readBytes returns a value equal to the length of the buffer, a > subsequent > readBytes call must be made. If there are no more bytes to be read, this > call returns -1. > > If the byte array field value is null, readBytes returns -1. > > If the byte array field value is empty, readBytes returns 0. > ---snip--- ---------------------------------------------------------------------- >Comment By: Tim Anderson (tanderson) Date: 2004-02-02 15:55 Message: Logged In: YES user_id=557161 Fixed in CVS. Fix will be available in the 0.5-b2 release. ---------------------------------------------------------------------- Comment By: Tim Anderson (tanderson) Date: 2004-01-30 21:55 Message: Logged In: YES user_id=557161 Agreed. The testIncrementalReadBytes() method also appears to be buggy. The last chunk it reads in only fills up half of the buffer, so the subsequent call to readBytes() should throw MessageEOFException rather than return -1. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=563359&aid=879678&group_id=81568 |