Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Awkward Memory Issues

 
Sid Singh
Greenhorn
Posts: 20
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rob Spoor
Sheriff
Pie
Posts: 20393
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us the code that's throwing that exception, plus the stack trace?
 
Sid Singh
Greenhorn
Posts: 20
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20393
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic