You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/05/11 18:53:29 UTC
cvs commit: xml-xalan/c/src/XalanTransformer XalanTransformer.cpp XalanTransformer.hpp
dbertoni 01/05/11 09:53:28
Modified: c/src/XalanTransformer XalanTransformer.cpp
XalanTransformer.hpp
Log:
Make sure resets happen, even if an uncaught exception is thrown.
Revision Changes Path
1.17 +17 -21 xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp
Index: XalanTransformer.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XalanTransformer.cpp 2001/04/27 20:56:51 1.16
+++ XalanTransformer.cpp 2001/05/11 16:53:23 1.17
@@ -251,6 +251,8 @@
*(m_functionPairs[f].second));
}
+ const EnsureReset theReset(*this);
+
// Do the transformation...
theProcessor.process(
theParsedXML.getDocument(),
@@ -258,8 +260,6 @@
tempResultTarget,
theStylesheetConstructionContext,
m_stylesheetExecutionContext);
-
- reset();
}
catch (XSLException& e)
{
@@ -319,14 +319,6 @@
theResult = -4;
}
- m_stylesheetExecutionContext.setXPathEnvSupport(0);
-
- m_stylesheetExecutionContext.setDOMSupport(0);
-
- m_stylesheetExecutionContext.setXObjectFactory(0);
-
- m_stylesheetExecutionContext.setXSLTProcessor(0);
-
return theResult;
}
@@ -413,6 +405,8 @@
*(m_functionPairs[f].second));
}
+ const EnsureReset theReset(*this);
+
// Do the transformation...
theProcessor.process(
theParsedXML.getDocument(),
@@ -477,16 +471,6 @@
theResult = -4;
}
- m_stylesheetExecutionContext.setXPathEnvSupport(0);
-
- m_stylesheetExecutionContext.setDOMSupport(0);
-
- m_stylesheetExecutionContext.setXObjectFactory(0);
-
- m_stylesheetExecutionContext.setXSLTProcessor(0);
-
- reset();
-
return theResult;
}
@@ -715,6 +699,7 @@
TranscodeToLocalCodePage(theMessage, m_errorMessage, true);
}
}
+
return 0;
}
@@ -826,6 +811,7 @@
TranscodeToLocalCodePage(theMessage, m_errorMessage, true);
}
}
+
return 0;
}
@@ -957,7 +943,7 @@
-void
+void
XalanTransformer::reset()
{
try
@@ -979,4 +965,14 @@
catch(...)
{
}
+}
+
+
+
+
+XalanTransformer::EnsureReset::~EnsureReset()
+{
+ m_transformer.m_stylesheetExecutionContext.reset();
+
+ m_transformer.reset();
}
1.20 +26 -8 xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp
Index: XalanTransformer.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- XalanTransformer.hpp 2001/04/27 20:56:51 1.19
+++ XalanTransformer.hpp 2001/05/11 16:53:26 1.20
@@ -249,8 +249,8 @@
* @param theInputSource input source
* @param theCompiledStylesheet pointer to a compiled stylesheet
* @param theOutputHandle void pointer passed through to callback.
- * @param theOutputHandler a user defined (callback) function.
- * @param theFlushHandler (optional) a user defined (callback) function.
+ * @param theOutputHandler a user defined callback function.
+ * @param theFlushHandler An optional user-defined callback function.
* @return 0 for success
*/
int
@@ -274,8 +274,8 @@
*
* @param theInputSource input source
* @param theOutputHandle void pointer passed through to callback.
- * @param theOutputHandler a user defined (callback) function.
- * @param theFlushHandler (optional) a user defined (callback) function.
+ * @param theOutputHandler a user defined callback function.
+ * @param theFlushHandler an optional user-defined callback function.
* @return 0 for success
*/
int
@@ -283,10 +283,10 @@
const XSLTInputSource& theInputSource,
const void* theOutputHandle,
XalanOutputHandlerType theOutputHandler,
- XalanFlushHandlerType theFlushHandler =0);
+ XalanFlushHandlerType theFlushHandler = 0);
/**
- * Creates a complied stylesheet. The input source can be
+ * Creates a compeled stylesheet. The input source can be
* a file name, a stream or a root node. The XalanTransformer
* instance owns the XalanCompiledStylesheet instance and will
* delete it when the XalanTransformer instance goes out of scope,
@@ -404,8 +404,8 @@
*/
void
uninstallExternalFunction(
- const char* theNamespace,
- const char* functionName);
+ const char* theNamespace,
+ const char* functionName);
/**
* Set a top-level stylesheet parameter. This value can be evaluated via
@@ -463,6 +463,24 @@
void
reset();
+
+ class EnsureReset
+ {
+ public:
+
+ EnsureReset(XalanTransformer& theTransformer) :
+ m_transformer(theTransformer)
+ {
+ }
+
+ ~EnsureReset();
+
+ private:
+
+ XalanTransformer& m_transformer;
+ };
+
+ friend class EnsureReset;
StylesheetExecutionContextDefault m_stylesheetExecutionContext;
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org