-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Milestone
Description
When I used MultipartBody class for improving the multipart logic of grizzly provider,
I met some problems(may be bug?).
- Wrong maxLength in MultipartBody#read(ByteBuffer buffer)
// int maxLength = buffer.capacity();
Sometimes buffer's capacity can be not equal to limit.
For more accurate max, I think that buffer.remaining() is better. - ByteArrayPart generated duplicated header bytes.
generateByteArrayBody(FilePart filePart) used Part#sendPart() for generating headers and data such as start, disposition header, content type and etc...
But headers already were already generated by generateFileStart().(initializeFilePart() --> generateFileStart() --> initializeByteArrayBody() --> generateByteArrayBody()) - fileLocation was not reinitialized after processing a FilePart.
When I tested parts which have both ByteArrayPart and FilePart, fileLocation's status was FileLocation.END. So second part couldn't generate right bytes.
About this issues, I will pull a request with a testcase.
PS) Maybe, current testcases doesn't use MultipartBody#read() but MultipartBody#transferTo() in multipart test.