Not sure if this is the case, but I found if I didn't close the file stream after reading and writing the XML, Castor would duplicate my class in the XML file when it wrote it out.. Once I closed both the streams, things worked perfectly.
I ended creating a simple util class that reads and writes my objects so I don't have to worry about the streams anymore..
- Tim
Nick Stuart wrote:
I haven't used the xml side of castor greatly, but have you tried deleting the old xml file, and then marshaling the object again? I know its kinda a shot in the dark, but since you said the first marshal worked fine its worth a shot.
On Tue, 02 Nov 2004 11:07:46 -0500, Velusamy Velu
<[EMAIL PROTECTED]> wrote:
Hello:
I am continuing to investigate this problem and found the following additional information -
The type of the object to be marshaled is VehicleReference public class VehicleReference extends Selectable { private ArrayList types = null; private ArrayList models = null; private ArrayList makes = null; private DropdownList statuses = null; private DropdownList locations = null; private String license = null; ... } To isolate and repeat the problem only the statuses is populated. All other attributes left in null state. The statuses is of type DropdownList which extends the java.util.ArrayList and adds a couple of more functionalities.
In debug mode while stepping through the code the object (an instance of VehicleReference) is good until the marshaller.marshall(object) method is called.
state of the object before calling - public class VehicleReference extends Selectable { private ArrayList types = null; private ArrayList models = null; private ArrayList makes = null; private DropdownList statuses = DropdowList (id=305) private DropdownList locations = null; private String license = null; ... }
state of the object after that call public class VehicleReference extends Selectable { private ArrayList types = DropdowList (id=306) private ArrayList models = DropdowList (id=304) private ArrayList makes = DropdowList (id=303) private DropdownList statuses = DropdowList (id=305) private DropdownList locations = DropdowList (id=302) private String license = null; ... }
The values assigned during the marshaling process to types, models, makes, and locations are all from a previous run (about 3 days old) of the program. All of those values are accurate values but not wanted now.
The result of this is the XML produced is incorrect.
I could see that the old object has been cached. But by which process? and why it does not refresh? and why it overrides the current state of the object? Why this happens only with the objects that are in collections (ArrayList or Vector)?
Your help would be greatly appreciated.
My previous email is truncated in the interest of keeping this thread relatively clean.
Thanks
Velusamy K. Velu (614) 728-0017
[EMAIL PROTECTED] 11/02/04 08:46AM >>>
Hello:
We are a developing a J2EE based web application. The combination of Struts and STxx is used to .
.
.
I wonder if anyone ran into this kind of problem. Any pointers would greatly help us. We have been spending about 4 days fruitlessly on this problem. I can provide more code snippets if necessary.
Thanks
Velusamy K. Velu (614) 728-0017
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-user
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
