[jboss-dev-forums] [Design the new POJO MicroContainer] - Careful with default serialization, JBVFS-17

scott.stark@jboss.org do-not-reply at jboss.com
Fri Feb 29 17:19:30 EST 2008


The serialization of the NestedJarFromStream is incorrect. Its using default serialization of these fields:

   private transient ZipInputStream zis;
   private URL jarURL;
   private URL entryURL;
   private long lastModified;
   private long size;
   private AtomicBoolean inited = new AtomicBoolean(false);

The problem is that the inited flag should not be serialized as this implies its parents fields:

   private transient List entries;
   private transient Map<String, VirtualFileHandler> entryMap;

have been initialized. They will not be after deserialization of NestedJarFromStream as it lazily does initialization. We need to be careful when adding fields to a class that is using the default java serialization contract.




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133376#4133376

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133376



More information about the jboss-dev-forums mailing list