EOFException OutputObjectStream readObject() peek


This blog talks a bit about a exception we see in java frameworks, and applications when we use ObjectOuputStream.readObject. The following are the possible causes
Possibility 1) In a setter you have the assignment the other way around

private Object value ;
setValue(Object newValue) {
newValue = value ;
}

Possibility 2) Data is null when passed into your code
Possibility 3) End of file has reached, and InputStream has no other way of telling you that the outputstream has been “closed”. So dont just throw the exception, handle it right here and right now.
Possibility 4) Something obvious is missing, put out your code snippet on a comment, I’ll review it for you

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s