| Author |
Awkward Memory Issues
|
Sid Singh
Greenhorn
Joined: Jun 14, 2010
Posts: 20
|
|
Hi Folks,
I came across a strange problem while unit testing of my application accross various environments like first local server then pre-production server and so on.
I was getting below exception
java.io.IOException: Underlying input stream returned zero bytes
Tried lot many things but all failed. Then i realised that the data size that i was testing with was a bit large so i reduced the size and with the same code things went well.
On different server even with the large data set my code was running properly.
I wonder such exception in no way depicts about the actual problem.
Can someone throw some light on this?
Thanks
Siddharth
|
OCPJP 6, SCWCD In Progress
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Can you show us the code that's throwing that exception, plus the stack trace?
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Sid Singh
Greenhorn
Joined: Jun 14, 2010
Posts: 20
|
|
Rob Spoor wrote:Can you show us the code that's throwing that exception, plus the stack trace?
Hi Rob,
Thanks for replying
The lines marked bold always throw the IOException and then it gets propogated from there.
The Trace which i got was
java.io.IOException: Underlying input stream returned zero bytes
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:268)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at com.database.DatabaseServices.getPacketData(DatabaseServices.java:134)
Thanks
Siddharth Singh
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
You're trying to read text data from a BLOB. Perhaps that BLOB is not a properly encoded string, or it's not encoded with the default encoding. In the latter case you can specify the actual encoding in the InputStreamReader constructor. In the former case you can't convert the BLOB into a String at all.
Perhaps it's a better idea to start using a CLOB instead of a BLOB. BLOB is Binary Large OBject, meant for binary data. CLOB is Character Large OBject, meant for text. JDBC uses Reader and Writer for CLOB.
|
 |
 |
|
|
subject: Awkward Memory Issues
|
|
|