Thursday, December 01, 2005

Part 4 of J2ME-Servlet mystery [SOLVED? I think so!]

Using the various methods of reading at the Servlet, I found that none of them worked perfectly:

1. With getReader() and reading from the raw InputStream, somehow the last 40bytes are always gone!

2. With getInputStream(), BufferedReader's readLine(), it gave me an ArrayIndexOutOfBoundsException when reading! The logs traced it back to a possible mismatch in the number of bytes indicated and what was actually found, in
sun.nio.cs.StreamDecoder$CharsetSD.readBytes() method


All these servlets are running on Tomcat 5.0.28. When I copied the servlet to another Tomcat server, this time v5.5.9, the servlet receives whatever J2ME client sends perfectly!

Is this a bug? This is a possibility I haven't entertained before, but it's worthwhile asking, seeing the number of similar questions out there.


This whole thing started as a series of posts of frustration, but they might contain clues to help you solve similar problem, as I wrote about the steps/approaches I've used to try solving the problem:

Part 3, Part 2, and Part 1

Warning: They're RANTS!

1 comment:

Anonymous said...

Thanks a lot.
I had been struggling with the same issue for the past 3 days.