<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-14617135.post6124909609778080616..comments</id><updated>2008-04-30T10:59:39.112+05:30</updated><category term='olympics'/><category term='myPicks'/><category term='JavaMail'/><category term='beijing 2008'/><category term='Java'/><category term='Serialization'/><category term='Hello World'/><title type='text'>Comments on Bits &amp; Bytes: Java Object Serialization</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.suryachaitanya.com/feeds/6124909609778080616/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14617135/6124909609778080616/comments/default'/><link rel='alternate' type='text/html' href='http://blog.suryachaitanya.com/2007/05/java-object-serialization-is-often_15.html'/><author><name>Surya Chaitanya Tamada</name><uri>http://www.blogger.com/profile/14424718086936885519</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-14617135.post-1290332623490438086</id><published>2007-09-18T20:53:00.000+05:30</published><updated>2007-09-18T20:53:00.000+05:30</updated><title type='text'>&lt;b&gt; Repeat step 2 if the returned Object has a wri...</title><content type='html'>&lt;B&gt; Repeat step 2 if the returned Object has a writeReplace(), until an object returned doesn't override writeReplace(). &lt;/B&gt; This is not true as ClassB also have writeReplace which returns object of type ClassB, this will put it in infinite loop.&lt;BR/&gt;so it is &lt;BR/&gt;&lt;B&gt; Repeat step 2 if the returned Object has a writeReplace(), until an object returned doesn't provide writeReplace() or writeReplace() returns the object of same type on which it is called. &lt;/B&gt; what do you think?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14617135/6124909609778080616/comments/default/1290332623490438086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14617135/6124909609778080616/comments/default/1290332623490438086'/><link rel='alternate' type='text/html' href='http://blog.suryachaitanya.com/2007/05/java-object-serialization-is-often_15.html?showComment=1190128980000#c1290332623490438086' title=''/><author><name>tegbir</name><uri>http://www.blogger.com/profile/15735248207395610793</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.suryachaitanya.com/2007/05/java-object-serialization-is-often_15.html' ref='tag:blogger.com,1999:blog-14617135.post-6124909609778080616' source='http://www.blogger.com/feeds/14617135/posts/default/6124909609778080616' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1594270547'/></entry><entry><id>tag:blogger.com,1999:blog-14617135.post-104508677322101718</id><published>2007-05-19T17:54:00.000+05:30</published><updated>2007-05-19T17:54:00.000+05:30</updated><title type='text'>Hi Surya&lt;br&gt;&lt;br&gt;I don't understand why U want to m...</title><content type='html'>Hi Surya&lt;BR/&gt;&lt;BR/&gt;I don't understand why U want to make the life so complicated :)&lt;BR/&gt;Anyway joke apart I hope to have understand what U mean:&lt;BR/&gt;&lt;BR/&gt;the result that U have expected can't be because readResolve and resolveObject are invoked ONLY when an object has been read by &lt;BR/&gt;&lt;BR/&gt;objectInputStream, so the order is:&lt;BR/&gt;&lt;BR/&gt;readObject&lt;BR/&gt;  readResolve&lt;BR/&gt;     resolveObject&lt;BR/&gt;&lt;BR/&gt;here why U get "CustomObjectInputStream.resolveObject [Class C: Test***String]"&lt;BR/&gt;after "ClassC.readObject"&lt;BR/&gt;&lt;BR/&gt;now U expect that ClassB.readResolve and then ClassA.rearResolve hat to be invoked when you create ClassB and ClassA&lt;BR/&gt;but that is not enough because the method are invoked only after the stream have read the object&lt;BR/&gt;&lt;BR/&gt;if U change the code in CustomObjectInputStream: &lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;if (obj instanceof ClassC) {            &lt;BR/&gt;   return new ClassB(((ClassC) obj).getClassCData()); &lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;&lt;BR/&gt;with:&lt;BR/&gt;&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;if (obj instanceof ClassC) {             &lt;BR/&gt;   return new ClassA(((ClassC) obj).getClassCData());  &lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;&lt;BR/&gt;U have the result expected.&lt;BR/&gt;If instead U had to pass through ClassB then actually will be a bit complicated ...&lt;BR/&gt;&lt;BR/&gt;cheers &lt;BR/&gt;Fabrizio</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14617135/6124909609778080616/comments/default/104508677322101718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14617135/6124909609778080616/comments/default/104508677322101718'/><link rel='alternate' type='text/html' href='http://blog.suryachaitanya.com/2007/05/java-object-serialization-is-often_15.html?showComment=1179577440000#c104508677322101718' title=''/><author><name>fabrizio</name><uri>http://www.blogger.com/profile/15973077284804873453</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.suryachaitanya.com/2007/05/java-object-serialization-is-often_15.html' ref='tag:blogger.com,1999:blog-14617135.post-6124909609778080616' source='http://www.blogger.com/feeds/14617135/posts/default/6124909609778080616' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-616873303'/></entry><entry><id>tag:blogger.com,1999:blog-14617135.post-6151859087470563068</id><published>2007-05-19T17:52:00.000+05:30</published><updated>2007-05-19T17:52:00.000+05:30</updated><title type='text'>Hi Surya&lt;br&gt;&lt;br&gt;I don't understand why U want to m...</title><content type='html'>Hi Surya&lt;BR/&gt;&lt;BR/&gt;I don't understand why U want to make the life so complicated :)&lt;BR/&gt;Anyway joke apart I hope to have understand what U mean:&lt;BR/&gt;&lt;BR/&gt;the result that U have expected can't be because readResolve and resolveObject are invoked ONLY when an object has been read by &lt;BR/&gt;&lt;BR/&gt;objectInputStream, so the order is:&lt;BR/&gt;&lt;BR/&gt;readObject&lt;BR/&gt;  readResolve&lt;BR/&gt;     resolveObject&lt;BR/&gt;&lt;BR/&gt;here why U get "CustomObjectInputStream.resolveObject [Class C: Test***String]"&lt;BR/&gt;after "ClassC.readObject"&lt;BR/&gt;&lt;BR/&gt;now U expect that ClassB.readResolve and then ClassA.rearResolve hat to be invoked when you create ClassB and ClassA&lt;BR/&gt;but that is not enough because the method are invoked only after the stream have read the object&lt;BR/&gt;&lt;BR/&gt;if U change the code in CustomObjectInputStream: &lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;if (obj instanceof ClassC) {            &lt;BR/&gt;   return new ClassB(((ClassC) obj).getClassCData()); &lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;&lt;BR/&gt;with:&lt;BR/&gt;&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;if (obj instanceof ClassC) {             &lt;BR/&gt;   return new ClassA(((ClassC) obj).getClassCData());  &lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;.&lt;BR/&gt;&lt;BR/&gt;U have the result expected.&lt;BR/&gt;If instead U had to pass through ClassB then actually will be a bit complicated ...&lt;BR/&gt;tell me what U think &lt;BR/&gt;&lt;BR/&gt;cheers &lt;BR/&gt;Fabrizio</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14617135/6124909609778080616/comments/default/6151859087470563068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14617135/6124909609778080616/comments/default/6151859087470563068'/><link rel='alternate' type='text/html' href='http://blog.suryachaitanya.com/2007/05/java-object-serialization-is-often_15.html?showComment=1179577320000#c6151859087470563068' title=''/><author><name>fabrizio</name><uri>http://www.blogger.com/profile/15973077284804873453</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.suryachaitanya.com/2007/05/java-object-serialization-is-often_15.html' ref='tag:blogger.com,1999:blog-14617135.post-6124909609778080616' source='http://www.blogger.com/feeds/14617135/posts/default/6124909609778080616' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-616873303'/></entry></feed>
