You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Johannes van der Merwe <jp...@iafrica.com> on 2001/12/13 21:52:56 UTC
object serialization
Hi all
Had to fix ParentNode::readObject when deserializing-got a NullPointer
Exception. This works, but it I am not certain of all it does.
/** Deserialize object. */
private void readObject(ObjectInputStream ois)
throws ClassNotFoundException, IOException {
// perform default deseralization
ois.defaultReadObject();
// hardset synchildren - so we don't try to sync- it does not make
any sense
// to try to synchildren when we just desealize object.
needsSyncChildren(false);
if (fNodeListCache==null)
{
// otherwise request a cache object
fNodeListCache = ownerDocument.getNodeListCache(this);
}
// initialize transients
fNodeListCache.fLength = -1;
fNodeListCache.fChildIndex = -1;
} // readObject(ObjectInputStream)
Kind Regards
Jo van der Merwe
J.P. van der Merwe
Technical Consultant : Business Integration
Dimension Data i-Commerce Software
*Tel: +27 011 263 5244
*Switchboard +27 011 263 5000
*Mobile: +27 082 322 6406
*Fax: +27 011 263 5301
*Helpdesk +27 086 1100 686
*Email Johannes.VDM@za.didata.com <ma...@za.didata.com>
*Website <http://www.ic.didata.com/>
Re: object serialization
Posted by Arnaud Le Hors <le...@us.ibm.com>.
> Hi all
>
> Had to fix ParentNode::readObject when deserializing-got a NullPointer
> Exception. This works, but it I am not certain of all it does.
>
> /** Deserialize object. */
> private void readObject(ObjectInputStream ois)
> throws ClassNotFoundException, IOException {
>
> // perform default deseralization
> ois.defaultReadObject();
>
> // hardset synchildren - so we don't try to sync- it does not make
> any sense
> // to try to synchildren when we just desealize object.
>
> needsSyncChildren(false);
>
> if (fNodeListCache==null)
> {
> // otherwise request a cache object
> fNodeListCache = ownerDocument.getNodeListCache(this);
> }
> // initialize transients
> fNodeListCache.fLength = -1;
> fNodeListCache.fChildIndex = -1;
>
> } // readObject(ObjectInputStream)
The right fix is actually to simply remove the last two lines.
fNodeListCache is set to a cache object later on if needed. I just
checked it in.
Thanks for your report!
--
Arnaud Le Hors - IBM, XML Standards Strategy Group / W3C AC Rep.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: object serialization
Posted by Arnaud Le Hors <le...@us.ibm.com>.
I have to say that I never made much effort to maintain the Java
serialization code of the DOM, so I'm even surprised it only requires a
small patch. :-)
I'll have a look at your patch.
Thanks.
--
Arnaud Le Hors - IBM, XML Standards Strategy Group / W3C AC Rep.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org