Here is the problem.
I have a log class which is responsible for recording things to a file and when asked, reading them back.
In a
unit test for this class I sent 10 log entries (a small class containing a date and a
string) into the log. These were serialized through an ObjectOutputStream into a new file. Then I asked for the objects back and using an ObjectInputStream the objects were all read back properly.
I then ran the same test again, however this time the file already existed so I opened the initial FileWriter to append to the file. I wrote another 10 objects to the file and then attempted to read the file back using the ObjectInputStream. The stream successfully read the 10 objects I put in the first time, but then threw the EOFException after reading only one of the second 10 entries I appended to the file. I looked at the file, and even in serialized form it is obvious all 20 objects are in the file.
If anyone can shed some light as to why this would happen, it would be appreciated. Also, if you need more info about the code, let me know.
Thanks in advance
Rob Cranston