views:

14

answers:

0

I have a class DataFile which is the top level class that I am serializing. DataFile contains an ArrayCollection which in-turn contains objects which extend ArrayData, each which overrides readExternal in different ways.

Over the course of the development the ArrayData object from version 1.0 is now different than the ArrayData object in version 1.1.

This causes deserialization to fail, most often with a null object error.

This is expected behavior. What I would like to happen is that in cases where an error occurs the object would simply be ignored and we would continue deserialization.

To effect this I have thrown try..catch logic into the deserialization for the ArrayData

override public function readExternal(input:IDataInput):void {
  try {
    testvalue = input.readObject();
    newTestValue = input.readObject(); //a value that is not a part of the file being deserialized
  catch(e:Error){
    //an error occurred, but just keep going
  }
} 

I was hoping that this would allow the deserialization chain to continue doing its thing and then would allow me to clean up the broken data after everything has been deserialized.

The problem I am now having is that the serialization of the ArrayCollection fails immediately after an error is caught in a bad ArrayData object with a index out of bounds error.

Error #2006: The supplied index is out of bounds.

I have tried faking data in the catch portion of te ArrayData object but nothing works. I don't know why the error is bubbling up the deserialization chain and I do not know how to prevent this.

If anyone has any ideas on where I should go next in an attempt to resolve this issue I would appreciate the feedback.

Thanks, Dan