Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!hb5g2000vbb.googlegroups.com!not-for-mail From: "raphfrk@gmail.com" Newsgroups: comp.lang.java.programmer Subject: Re: De-serializing an object with missing child classes Date: Wed, 7 Sep 2011 07:14:47 -0700 (PDT) Organization: http://groups.google.com Lines: 16 Message-ID: <4d1a98fa-bef3-45d5-97c3-3df29265ffe1@hb5g2000vbb.googlegroups.com> References: <774ae53e-c127-4d79-8267-d8c8197d0dfb@z7g2000vbp.googlegroups.com> <9651530b-9ed9-41cc-b686-b0644226a65a@a31g2000vbt.googlegroups.com> <9coeqfFfujU1@mid.individual.net> NNTP-Posting-Host: 137.71.226.54 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1315406479 10029 127.0.0.1 (7 Sep 2011 14:41:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 7 Sep 2011 14:41:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: hb5g2000vbb.googlegroups.com; posting-host=137.71.226.54; posting-account=iOAcbgoAAADC8J1iW-JMMSO74f5TboSg User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7677 On Sep 7, 6:46=A0am, Robert Klemme wrote: > I am not sure I get exactly what you mean here. =A0Do you want to > resurrect class objects (i.e. the code) from the stream? =A0I don't think > this is possible without complex logic. I was thinking that the standard deserializer might be a relatively low complexity recursive method. It may be possible to copy that and update it where it checks for a class match. In the end I just had the custom reader use the defaultReadObject() method and then read again. If it hit EOF, then I assumed that it was the old type. Otherwise it read the extra info and updated accordingly. When read, it stored the child objects as either a byte array stored in a dummy object or as the actual object if it could be deserialized.