• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Awkward Memory Issues

 
Greenhorn
Posts: 20
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic