• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" java.io.EOFException  RSS feed

 
L Willie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exception in thread "main" java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2281)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at storeCert.main(storeCert.java:12)



source :http://www.java2s.com/Tutorial/Java/0490__Security/StoreCertificate.htm

what wrong with the code?why the error message appear during execute ?

is it cause by the no contain in CertPath.dat?
[ September 27, 2008: Message edited by: L Willie ]
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears that there is no valid header in the file.

ObjectInputStream and ObjectOutputStream use a header at the start of the stream and, because the exception is thrown by your "new ObjectInputStream(f)" call, that header seems to be the problem.

Are you sure the file is written using ObjectOutputStream?
 
L Willie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:
It appears that there is no valid header in the file.

ObjectInputStream and ObjectOutputStream use a header at the start of the stream and, because the exception is thrown by your "new ObjectInputStream(f)" call, that header seems to be the problem.

Are you sure the file is written using ObjectOutputStream?

thank your reply,understand my problem already,10Q
 
Kushagra Bindal
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[ UD: Please do not post unrelated questions into existing topics. That's called "hijacking" and is considered an impolite thing to do. ]
[ October 15, 2008: Message edited by: Ulf Dittmer ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!