• Post Reply Bookmark Topic Watch Topic
  • New Topic

BufferedReader is not Serializable?

 
Alex Garci
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to guess why I can't run correctly my program. My code is this one:





When I choose the option number 3 I displayed the error:

Error al leer del fichero
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.io.BufferedReader

After reading the error I thought the BufferedReader class is not serializable, so I decided became it transient:



But when I run the program again I got the same error.

What's wrong?

Thanks.

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
most of the stream classes in java.io. are not searializable, which make sense to not make them store because they are *live* stream.

how about Venta in your class?
 
Alex Garci
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Here is the code of Venta class:

 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your fix making the BufferedReader transient should fix the problem - if it doesn't, that probably means you still have traces of the old code lying around. Try deleting all your .class files, and the Ventas.dat file as well, which may contain data serialized from the old code.
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alex Garci wrote:When I choose the option number 3 I displayed the error:

Error al leer del fichero
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.io.BufferedReader

That doesn't seem to match the code you showed - are you reading or writing? Also your code shows that you're printing the stack trace - what does that output look like?
 
Alex Garci
Greenhorn
Posts: 15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have deleted all .class files and Ventas.dat file as you told me and now it works.

Thank you for the answer Mike.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!