• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EOFException is null

 
Greenhorn
Posts: 9
Android
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have an app that acts as a server, and a java program, that connects to it via a TCP socket. The app then waits for commands from the client by calling DataInputStream.readInt(). If I then shut down the client application (when the socket connection is established, and the server is blocking at readInt()), a EOFException is thrown. If I catch it with a IOException Handler though, the Exception object is null! If I catch it with a EOFException Handler, it is a normal EOFException...



It works well, when I just use the EOFException Handler, I'm just curious, is this a bug, or a logical behaviour? I didn't know that Exception objects can be null... In a Stackoverflow question (http://stackoverflow.com/questions/3949609/exception-is-null-always) somebody had a similar problem, and one answer was that "Eclipse probably can't get a correct instance of this exception", but I do not understand what that means, could somebody explain?

Cheers,
Don
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic