santiagopg 2003/02/10 09:35:19
Modified: java/src/org/apache/xalan/xsltc/trax
TemplatesHandlerImpl.java
Log:
Wrapped called to Stylesheet.translate() with class-level synchronization
block. This is needed since BCEL is not thread-safe. The bug was reported
by Michael Melhem (Cocoon).
Revision Changes Path
1.19 +14 -10
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java
Index: TemplatesHandlerImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- TemplatesHandlerImpl.java 30 Jan 2003 18:46:14 -0000 1.18
+++ TemplatesHandlerImpl.java 10 Feb 2003 17:35:19 -0000 1.19
@@ -82,8 +82,8 @@
/**
* Implementation of a JAXP1.1 TemplatesHandler
*/
-public class TemplatesHandlerImpl extends Parser
- implements TemplatesHandler, SourceLoader
+public class TemplatesHandlerImpl extends Parser
+ implements TemplatesHandler, SourceLoader
{
/**
* System ID for this stylesheet.
@@ -109,8 +109,8 @@
/**
* Default constructor
*/
- protected TemplatesHandlerImpl(int indentNumber,
- TransformerFactoryImpl tfactory)
+ protected TemplatesHandlerImpl(int indentNumber,
+ TransformerFactoryImpl tfactory)
{
super(null);
_indentNumber = indentNumber;
@@ -202,22 +202,26 @@
// Set it as top-level in the XSLTC object
xsltc.setStylesheet(stylesheet);
- // Create AST under the Stylesheet element
+ // Create AST under the Stylesheet element
createAST(stylesheet);
}
// Generate the bytecodes and output the translet class(es)
if (!errorsFound() && stylesheet != null) {
stylesheet.setMultiDocument(xsltc.isMultiDocument());
- stylesheet.translate();
+
+ // Class synchronization is needed for BCEL
+ synchronized (xsltc.getClass()) {
+ stylesheet.translate();
+ }
}
if (!errorsFound()) {
// Check that the transformation went well before returning
final byte[][] bytecodes = xsltc.getBytecodes();
if (bytecodes != null) {
- final TemplatesImpl templates =
- new TemplatesImpl(xsltc.getBytecodes(), transletName,
+ final TemplatesImpl templates =
+ new TemplatesImpl(xsltc.getBytecodes(), transletName,
getOutputProperties(), _indentNumber, _tfactory);
// Set URIResolver on templates object
@@ -237,7 +241,7 @@
/**
* Recieve an object for locating the origin of SAX document events.
* Most SAX parsers will use this method to inform content handler
- * of the location of the parsed document.
+ * of the location of the parsed document.
*/
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]