dbertoni 01/09/14 13:58:01
Modified: c/src/XalanTransformer XalanTransformer.cpp
Log:
Cleaned up some error handling and strings.
Revision Changes Path
1.34 +27 -19 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.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- XalanTransformer.cpp 2001/09/06 18:41:11 1.33
+++ XalanTransformer.cpp 2001/09/14 20:58:01 1.34
@@ -362,7 +362,7 @@
theStylesheetConstructionContext,
*m_stylesheetExecutionContext);
}
- catch (XSLException& e)
+ catch(const XSLException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -373,9 +373,9 @@
TranscodeToLocalCodePage(e.getMessage(),
m_errorMessage, true);
}
- theResult = -1;
+ theResult = -1;
}
- catch (SAXException& e)
+ catch(const SAXException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -388,7 +388,7 @@
theResult = -2;
}
- catch (XMLException& e)
+ catch(const XMLException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -412,7 +412,7 @@
XalanDOMString theMessage("XalanDOMException caught.
The code is ");
append(theMessage,
LongToDOMString(long(e.getExceptionCode())));
- append(theMessage, XalanDOMString("."));
+ append(theMessage, XalanUnicode::charFullStop);
TranscodeToLocalCodePage(theMessage, m_errorMessage,
true);
}
@@ -537,7 +537,7 @@
tempResultTarget,
*m_stylesheetExecutionContext);
}
- catch (XSLException& e)
+ catch(const XSLException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -548,9 +548,9 @@
TranscodeToLocalCodePage(e.getMessage(),
m_errorMessage, true);
}
- theResult = -1;
+ theResult = -1;
}
- catch (SAXException& e)
+ catch(const SAXException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -563,7 +563,7 @@
theResult = -2;
}
- catch (XMLException& e)
+ catch(const XMLException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -587,7 +587,7 @@
XalanDOMString theMessage("XalanDOMException caught.
The code is ");
append(theMessage,
LongToDOMString(long(e.getExceptionCode())));
- append(theMessage, XalanDOMString("."));
+ append(theMessage, XalanUnicode::charFullStop);
TranscodeToLocalCodePage(theMessage, m_errorMessage,
true);
}
@@ -630,6 +630,8 @@
}
}
+
+
int
XalanTransformer::transform(
const XSLTInputSource& theInputSource,
@@ -793,6 +795,9 @@
theProcessor.setProblemListener(&theProblemListener);
+ // Allocate the memory now, to avoid leaking if push_back()
fails.
+ m_compiledStylesheets.reserve(m_compiledStylesheets.size() + 1);
+
// Create a new XalanCompiledStylesheet.
theCompiledStylesheet =
new XalanCompiledStylesheetDefault(
@@ -803,7 +808,7 @@
// Store it in a vector.
m_compiledStylesheets.push_back(theCompiledStylesheet);
}
- catch (XSLException& e)
+ catch(const XSLException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -816,7 +821,7 @@
theResult = -1;
}
- catch (SAXException& e)
+ catch(const SAXException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -829,7 +834,7 @@
theResult = -2;
}
- catch (XMLException& e)
+ catch(const XMLException& e)
{
if (length(theErrorMessage) != 0)
{
@@ -854,7 +859,7 @@
append(theMessage,
LongToDOMString(long(e.getExceptionCode())));
- append(theMessage, XalanDOMString("."));
+ append(theMessage, XalanUnicode::charFullStop);
TranscodeToLocalCodePage(theMessage, m_errorMessage,
true);
}
@@ -924,6 +929,9 @@
try
{
+ // Allocate the memory now, to avoid leaking if push_back()
fails.
+ m_parsedSources.reserve(m_parsedSources.size() + 1);
+
if(useXercesDOM == true)
{
theParsedSource = new
XercesDOMParsedSource(theInputSource, m_useValidation);
@@ -936,19 +944,19 @@
// Store it in a vector.
m_parsedSources.push_back(theParsedSource);
}
- catch (XSLException& e)
+ catch(const XSLException& e)
{
TranscodeToLocalCodePage(e.getMessage(), m_errorMessage, true);
theResult = -1;
}
- catch (SAXException& e)
+ catch(const SAXException& e)
{
TranscodeToLocalCodePage(e.getMessage(), m_errorMessage, true);
theResult = -2;
}
- catch (XMLException& e)
+ catch(const XMLException& e)
{
TranscodeToLocalCodePage(e.getMessage(), m_errorMessage, true);
@@ -958,9 +966,9 @@
{
XalanDOMString theMessage("XalanDOMException caught. The code
is ");
- append(theMessage,
LongToDOMString(long(e.getExceptionCode())));
+ append(theMessage, LongToDOMString(long(e.getExceptionCode())));
- append(theMessage, XalanDOMString("."));
+ append(theMessage, XalanUnicode::charFullStop);
TranscodeToLocalCodePage(theMessage, m_errorMessage, true);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]