http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2005 *** shadow/2005 Tue Jun 5 08:12:31 2001 --- shadow/2005.tmp.4382 Tue Jun 5 08:12:31 2001 *************** *** 0 **** --- 1,39 ---- + +============================================================================+ + | Null-pointer in XPath with serialized Templates ( org.apache.xalan.templat | + +----------------------------------------------------------------------------+ + | Bug #: 2005 Product: XalanJ2 | + | Status: NEW Version: 2.0.1 | + | Resolution: Platform: PC | + | Severity: Normal OS/Version: All | + | Priority: Other Component: org.apache.xalan.templa | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + Serialization of Templates to disk/database etc cannot be achieved due to + transients declared in UnionPathIterator. On attempting to use the de- + serialized template object later on, most XPath statements throw + null pointer exceptions. + + Code to generate a serialized StylesheetRoot on disk: + + String outFileName = "c:/stylesheets/foobar.templates"; + + //Create the Templates (actually + org.apache.xalan.templates.StylesheetRoot)... + SAXTransformerFactory transfactSAX =(SAXTransformerFactory) + TransformerFactory.newInstance(); + Templates templates = transfactSAX.newTemplates(new + StreamSource("file:///c:/stylesheets/foobar.xsl")) ; + + // Write the Templates to disk ... + FileOutputStream ostream = new FileOutputStream(outFileName); + java.io.ObjectOutputStream p = new + java.io.ObjectOutputStream(ostream); + p.writeObject(templates); + p.flush(); + ostream.close(); \ No newline at end of file