tree serialization error

A

Andreas Beresko

hi,

i got following problem: i have a tree with some object. i can add new
objects to the tree an remove them - everything works fine.
now i serialize the tree - works fine. I only do writeObject(mytree) , don't
deserialize it. Now i want to change my tree again - add objects
still works, but when i try to remove an object (I do this by using
removeNodeFromParent() from the DefaultTreeModel) i get following
exception:

java.lang.ArrayIndexOutOfBoundsException: 0 >= 0

at java.util.Vector.elementAt(Unknown Source) and so and and so on ....


When I debug the code, I see the Exception is was thrown by the
DefaultTreeModel.class (but I can't localize the methode, maybe missing
debug informations?). However, if i dont't use the line writeObject(mytree)
everything works fine, that means the serialization process causes a problem
in
my tree(model). How can thsi be, any ideas ?

best regards Andreas
 
C

Chris Smith

Andreas said:
When I debug the code, I see the Exception is was thrown by the
DefaultTreeModel.class (but I can't localize the methode, maybe missing
debug informations?). However, if i dont't use the line writeObject(mytree)
everything works fine, that means the serialization process causes a problem
in my tree(model). How can thsi be, any ideas ?

It's certainly not expected that writeObject would do this. Do you
include any objects that implement Externalizable, or do you implement
any of the serialization magic methods (readResolve, writeReplace, etc.)
that might result in running some of your own code that changes an
object during serialization?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
A

Andreas Beresko

I don't use extraordinary object in my class, only standard types like
String, Vector (with stored Object Types) and JPopupMenus.
Furthermore i use no "magic ser. methods" only the default objectWrite
method to save the file.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top