Hi All, In class org.apache.xalan.lib.ExsltStrings, a static member of type "Document" is kept around to be used as a factory for Elements, etc.
The object is created using the normal expression: lDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(). There is, therefore, no guaruntee that this is a Xerces Document object. This object is accessed without any locking from the following static methods: * split(String str, String pattern) * tokenize(String toTokenize, String delims) The methods invoked on the Document object are: * Element org.w3c.dom.Document.createElement(String) * Text org.w3c.dom.Document.createTextNode(String) What this means is that there may be multiple threads simultaneously invoking the above methods on a single Document object. Is this safe? I cannot find any documentation on the subject of the thread-safety of the Document methods listed above. If these are not thread-safe, then perhaps a bug should be raised against ExsltStrings? In addition, the static member is initialized in a non-thread-safe manner. However, due to the way the resulting object is used I do not think that any race condition can result. The worst that can happen is that multiple Document objects are created, only one of which is then cached for later use. I think this is probably not worth fixing [though might be worth adding a comment about]. Regards, Simon
