Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ChunkedInputStream in JRE 1.4.x

843798Oct 31 2003 — edited Feb 20 2007
Hi

Before I go entering a bug I wondered if anyone else had come across an already highlighted issue with the sun.net.www.http.ChunkedInputStream class. Looking at the source code it along with other parts of the IO routines has been changed between JDK 1.3 and JDK 1.4.

The particular application where im running into this problem, is using the default Javax XMl parser (Crimson) to download and parse (usin SAX) an XML file specified by URI. It doesn't matter how I pass the input source to the parser, via URI string, or an input stream i create from a URL object myself. When accessing a URL which responds with a non chunked HTTP response everything works, but if it is a chunked HTTP response then the XML declaration in particular its encoding is not processed correctly and subsequently I recieve an malformed character encoding exception.

I have traced this through all the code to the use of the ChunkedInputStream where by when it is bundled in a PushbackInputStream (although it may not have to be). If an initial read of bytes and unread of those 4 bytes is done. Then if you try to read another block of data whilst debugingit clearly does not read sufficient data from the internal stream buffer (decoding the chunked encoding of the HTTP response), so that it results in passing back a buffer that is way short of what is required. Even through the internal stream has correctly recieved all the necessary data. I have sample code and files to reproduce all of this, but wanted to see if anyone had come across this or knew of a bug id first. It oocurs in both 1.4.1_2 and 1.4.2_02 running unders Windows 2000, from the code I suspect it will occur on any platform but havent tested it yet.

Thanks

Tony
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 20 2007
Added on Oct 31 2003
3 comments
666 views