• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Awkward Memory Issues

 
Greenhorn
Posts: 20
Eclipse IDE Oracle Java
  • 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
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • 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 Oracle Java
  • 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
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • 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.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic