[jdom-interest] [Fwd: Bug in JDOM serialization]
    Elliotte Rusty Harold 
    elharo at metalab.unc.edu
       
    Sun May 18 08:43:12 PDT 2003
    
    
  
At 2:29 PM -0800 3/27/03, Jason Hunter wrote:
>As we just noticed, the additional namespaces in the JDOM element 
>are transient. This is bad.
No, it's not. Only the fields are transient, not the information. The 
fields are transient because JDOM uses the flyweight design pattern 
to hold namespaces. Using transient ensures that deserialization 
won't actually create duplicates of things that are supposed to have 
only one instance.
However, if you look deeper in the code you'll notice that Element 
has custom readObject() and writeObject() methods that do store the 
additional namespaces in a way that's consistent with flyweights, so 
nothing is ever lost.
-- 
   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA
    
    
More information about the jdom-interest
mailing list