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 2008/08/05 21:38:53 UTC

svn commit: r682895 - in /xalan/c/trunk/src/xalanc: NLS/en_US/ PlatformSupport/ XSLT/ XalanTransformer/ XercesParserLiaison/

Author: dbertoni
Date: Tue Aug  5 12:38:52 2008
New Revision: 682895

URL: http://svn.apache.org/viewvc?rev=682895&view=rev
Log:
Clean up of error formatting code to use a single, consistent format, with better localization.  Cleaned up const-correctness issue to remove casting away const of a member variable.

Modified:
    xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf
    xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.cpp
    xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.hpp
    xalan/c/trunk/src/xalanc/PlatformSupport/XalanLocator.hpp
    xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp
    xalan/c/trunk/src/xalanc/XSLT/ProblemListener.hpp
    xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp
    xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.hpp
    xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.cpp
    xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.hpp
    xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp

Modified: xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf (original)
+++ xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf Tue Aug  5 12:38:52 2008
@@ -454,19 +454,49 @@
 		<target>The function '{0}' accepts one argument.</target>
 </trans-unit>
 
-<trans-unit id="Error_1Param">
-		<source>Error: {0}</source>
-		<target>Error: {0}</target>
+<trans-unit id="XSLTError">
+        <source>XSLT error</source>
+        <target>XSLT error</target>
 </trans-unit>
 
-<trans-unit id="Warning_1Param">
-		<source>Warning: {0}</source>
-		<target>Warning: {0}</target>
+<trans-unit id="XSLTWarning">
+        <source>XSLT warning</source>
+        <target>XSLT warning</target>
 </trans-unit>
 
-<trans-unit id="Message_1Param">
-		<source>Message: {0}</source>
-		<target>Message: {0}</target>
+<trans-unit id="XSLTMessage">
+        <source>XSLT message</source>
+        <target>XSLT message</target>
+</trans-unit>
+
+<trans-unit id="XMLError">
+        <source>XML error</source>
+        <target>XML error</target>
+</trans-unit>
+
+<trans-unit id="XMLWarning">
+        <source>XML warning</source>
+        <target>XML warning</target>
+</trans-unit>
+
+<trans-unit id="XMLMessage">
+        <source>XML message</source>
+        <target>XML message</target>
+</trans-unit>
+
+<trans-unit id="XPathError">
+        <source>XPath error</source>
+        <target>XPath error</target>
+</trans-unit>
+
+<trans-unit id="XPathWarning">
+        <source>XPath warning</source>
+        <target>XPath warning</target>
+</trans-unit>
+
+<trans-unit id="XPathMessage">
+        <source>XPath message</source>
+        <target>XPath message</target>
 </trans-unit>
 
 <trans-unit id="StyleTreeNode_1Param">
@@ -605,18 +635,13 @@
 </trans-unit>
 
 <trans-unit id="Warning2">
-		<source>Warning.</source>
-		<target>Warning.</target>
-</trans-unit>
-
-<trans-unit id="AtFileLineColumn_3Param">
-		<source>Occurred at file {0}, line {1}, column {2}.</source>
-		<target>Occurred at file {0}, line {1}, column {2}.</target>
+		<source>Warning: </source>
+		<target>Warning: </target>
 </trans-unit>
 
 <trans-unit id="FatalError">
-		<source>Fatal Error.</source>
-		<target>Fatal Error.</target>
+		<source>Fatal Error: </source>
+		<target>Fatal Error: </target>
 </trans-unit>
 
 <trans-unit id="FormatNumberFailed">
@@ -629,9 +654,24 @@
 		<target>Internal error: An invalid match op code '{0}' was detected.</target>
 </trans-unit>
 
-<trans-unit id="AtUnknownFileLineColumn_2Param">
-		<source>Occurred at unknown file, line {0}, column {1}.</source>
-		<target>Occurred at unknown file, line {0}, column {1}.</target>
+<trans-unit id="InEntity_1Param">
+		<source>Occurred in entity '{0}', at an unknown location.</source>
+		<target>Occurred in entity '{0}', at an unknown location.</target>
+</trans-unit>
+
+<trans-unit id="InEntity_3Param">
+		<source>Occurred in entity '{0}', at line {1}, column {2}.</source>
+		<target>Occurred in entity '{0}', at line {1}, column {2}.</target>
+</trans-unit>
+
+<trans-unit id="InUnknownEntity_2Param">
+		<source>Occurred in an unknown entity, at line {0}, column {1}.</source>
+		<target>Occurred in an unknown entity, at line {0}, column {1}.</target>
+</trans-unit>
+
+<trans-unit id="InUnknownEntity">
+        <source>Occurred in an unknown entity, at an unknown location.</source>
+        <target>Occurred in an unknown entity, at an unknown location.</target>
 </trans-unit>
 
 <trans-unit id="EmptyNodeList">

Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.cpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.cpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.cpp Tue Aug  5 12:38:52 2008
@@ -20,6 +20,8 @@
 
 
 
+#include "LocalMsgIndex.hpp"
+#include "XalanMessageLoader.hpp"
 #include "XalanUnicode.hpp"
 #include "DOMStringHelper.hpp"
 
@@ -34,11 +36,12 @@
 		const XalanDOMString&	theURI,
 		XalanFileLoc			theLineNumber,
 		XalanFileLoc			theColumnNumber,
-        MemoryManagerType&      theManager) :
+        MemoryManager&          theManager) :
 	m_message(theMessage, theManager),
 	m_uri(theURI, theManager),
 	m_lineNumber(theLineNumber),
-	m_columnNumber(theColumnNumber)
+	m_columnNumber(theColumnNumber),
+    m_memoryManager(theManager)
 {
 }
 
@@ -47,9 +50,12 @@
 XSLException::XSLException(
 			const LocatorType&		theLocator,
 			const XalanDOMString&	theMessage,
-            MemoryManagerType&      theManager) :
-	m_message(theMessage,theManager),
-	m_uri(theLocator.getSystemId() == 0 ? &s_dummy : theLocator.getSystemId(), theManager),
+            MemoryManager&          theManager) :
+    m_memoryManager(theManager),
+	m_message(theMessage, theManager),
+	m_uri(
+        theLocator.getSystemId() == 0 ? &s_dummy : theLocator.getSystemId(),
+        theManager),
 	m_lineNumber(theLocator.getLineNumber()),
 	m_columnNumber(theLocator.getColumnNumber())
 {
@@ -59,21 +65,24 @@
 
 XSLException::XSLException(
 		const XalanDOMString&	theMessage,
-        MemoryManagerType&      theManager) :
-	m_message(theMessage,theManager),
+        MemoryManager&          theManager) :
+    m_memoryManager(theManager),
+	m_message(theMessage, theManager),
 	m_uri(theManager),
 	m_lineNumber(XalanLocator::getUnknownValue()),
 	m_columnNumber(XalanLocator::getUnknownValue())
 {
 }
 
+
+
 XSLException::XSLException(const XSLException&	other) :
-	m_message(other.m_message,other.getMemoryManager()),
-	m_uri(other.m_uri, other.getMemoryManager()),
+    m_memoryManager(other.m_memoryManager),
+	m_message(other.m_message, m_memoryManager),
+	m_uri(other.m_uri, m_memoryManager),
 	m_lineNumber(other.m_lineNumber),
 	m_columnNumber(other.m_columnNumber)
 {
-    // hack : breal const-ness , use the same memory manager
 }
 
 
@@ -82,55 +91,21 @@
 {
 }
 
+
+
 void
 XSLException::defaultFormat(XalanDOMString&		theBuffer) const
 {
-	defaultFormat(m_message, m_uri, m_lineNumber, m_columnNumber, getType(), theBuffer);
+	defaultFormat(
+        m_message,
+        m_uri,
+        m_lineNumber,
+        m_columnNumber,
+        getType(),
+        theBuffer);
 }
 
 
-static
-XalanDOMChar	colonString[] =
-{
-	XalanUnicode::charColon,
-	XalanUnicode::charSpace,
-	0
-};
-
-
-
-static
-XalanDOMChar	lineString[] =
-{
-	XalanUnicode::charComma,
-	XalanUnicode::charSpace,
-	XalanUnicode::charLetter_l,
-	XalanUnicode::charLetter_i,
-	XalanUnicode::charLetter_n,
-	XalanUnicode::charLetter_e,
-	XalanUnicode::charSpace,
-	0
-};
-
-
-
-static
-XalanDOMChar	columnString[] =
-{
-	XalanUnicode::charComma,
-	XalanUnicode::charSpace,
-	XalanUnicode::charLetter_c,
-	XalanUnicode::charLetter_o,
-	XalanUnicode::charLetter_l,
-	XalanUnicode::charLetter_u,
-	XalanUnicode::charLetter_m,
-	XalanUnicode::charLetter_n,
-	XalanUnicode::charSpace,
-	0
-};
-
-
-
 void
 XSLException::defaultFormat(
 			const XalanDOMChar*					theMessage,
@@ -143,16 +118,61 @@
 			const XalanDOMString::size_type		theTypeLength,
 			XalanDOMString&						theBuffer)
 {
-	theBuffer.append(theType, theTypeLength);
-	theBuffer.append(colonString);
+    assert(
+        (theMessageLength == 0 || theMessage != 0) &&
+        (theURILength == 0 || theURI != 0) &&
+        (theTypeLength == 0 || theType != 0));
+
+    if (theTypeLength != 0)
+    {
+	    theBuffer.append(theType, theTypeLength);
+	    theBuffer += XalanDOMChar(XalanUnicode::charColon);
+	    theBuffer += XalanDOMChar(XalanUnicode::charSpace);
+    }
+
 	theBuffer.append(theMessage, theMessageLength);
 	theBuffer += XalanDOMChar(XalanUnicode::charSpace);
 	theBuffer += XalanDOMChar(XalanUnicode::charLeftParenthesis);
-	theBuffer.append(theURI, theURILength);
-	theBuffer += lineString;
-	NumberToDOMString(theLineNumber, theBuffer);
-	theBuffer += columnString;
-	NumberToDOMString(theColumnNumber, theBuffer);
+
+    // Assume we have reasonable locator information.
+    XalanMessages::Codes    theMessageID = XalanMessages::InEntity_3Param;
+
+    XalanDOMString  theMessageBuffer(theBuffer.getMemoryManager());
+    XalanDOMString  theLineNumberBuffer(theBuffer.getMemoryManager());
+    XalanDOMString  theColumnNumberBuffer(theBuffer.getMemoryManager());
+
+    if (XalanLocator::isUnknownValue(theLineNumber))
+    {
+        // We assume that if the line number is unknown,
+        // that the column number will also be unknown.
+        if (theURILength == 0)
+        {
+            theMessageID = XalanMessages::InUnknownEntity;
+        }
+        else
+        {
+            theMessageID = XalanMessages::InEntity_1Param;
+        }
+    }
+    else
+    {
+        if (theURILength == 0)
+        {
+            theMessageID = XalanMessages::InUnknownEntity_2Param;
+        }
+
+        NumberToDOMString(theLineNumber, theLineNumberBuffer);
+        NumberToDOMString(theColumnNumber, theColumnNumberBuffer);
+    }
+
+    XalanMessageLoader::getMessage(
+        theMessageBuffer,
+        theMessageID,
+        theURI,
+        theLineNumberBuffer.c_str(),
+        theColumnNumberBuffer.c_str());
+
+    theBuffer.append(theMessageBuffer);
 	theBuffer += XalanDOMChar(XalanUnicode::charRightParenthesis);
 }
 

Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.hpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.hpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XSLException.hpp Tue Aug  5 12:38:52 2008
@@ -56,7 +56,7 @@
 			const XalanDOMString&	theURI,
 			XalanFileLoc			theLineNumber,
 			XalanFileLoc			theColumnNumber,
-            MemoryManagerType&      theManager);
+            MemoryManager&          theManager);
 	/**
 	 * Constructor
 	 * 
@@ -67,7 +67,7 @@
 	XSLException(
 			const LocatorType&		theLocator,
 			const XalanDOMString&	theMessage,
-            MemoryManagerType&      theManager);
+            MemoryManager&          theManager);
 	/**
 	 * Constructor
 	 * 
@@ -76,7 +76,7 @@
 	 */
 	XSLException(
 			const XalanDOMString&	theMessage,
-            MemoryManagerType&      theManager);
+            MemoryManager&          theManager);
 
 
 	XSLException(const XSLException&	other);
@@ -136,12 +136,16 @@
 		return m_columnNumber;
 	}
 
-    MemoryManagerType& 
-    getMemoryManager()const
+    const MemoryManager&
+    getMemoryManager() const
     {
-        XalanDOMString* pnt = const_cast<XalanDOMString*>(&m_message);
+        return m_memoryManager;
+    }
 
-        return pnt->getMemoryManager();
+    MemoryManager&
+    getMemoryManager()
+    {
+        return m_memoryManager;
     }
 
 	void
@@ -203,15 +207,17 @@
 			const XalanDOMString::size_type		theTypeLength,
 			XalanDOMString&						theBuffer);
 
-private:
+protected:
+
+    mutable MemoryManager&  m_memoryManager;
 	
+private:
+
 	const XalanDOMString	m_message;
 	const XalanDOMString	m_uri;
 
 	const XalanFileLoc		m_lineNumber;
 	const XalanFileLoc	    m_columnNumber;
-
-
 };
 
 

Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanLocator.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanLocator.hpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanLocator.hpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanLocator.hpp Tue Aug  5 12:38:52 2008
@@ -79,7 +79,24 @@
     static XalanFileLoc
     getUnknownValue()
     {
-        return XalanFileLoc(-1);
+        // The parser reports the maximum value of the XalanFileLoc
+        // type for an unknown value.
+        return ~static_cast<XalanFileLoc>(0);
+    }
+
+    static XalanFileLoc
+    getUnknownDisplayValue()
+    {
+        // The parser reports the maximum value of the XalanFileLoc
+        // type for an unknown value, but that is really non-sensical
+        // for display purposes, so we use 0 instead.
+        return static_cast<XalanFileLoc>(0);
+    }
+
+    static bool
+    isUnknownValue(XalanFileLoc     theLocation)
+    {
+        return theLocation == getUnknownValue();
     }
 
 private:

Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp Tue Aug  5 12:38:52 2008
@@ -493,7 +493,7 @@
     m_code(theSource.m_code),
     m_encoding(
         theSource.m_encoding,
-        theSource.getMemoryManager())
+        m_memoryManager)
 {
 }
 
@@ -561,7 +561,7 @@
     m_badCharacter(theCharacter),
     m_encoding(
         theEncoding,
-        theBuffer.getMemoryManager())
+        m_memoryManager)
 {
 }
 
@@ -572,7 +572,7 @@
     m_badCharacter(theSource.m_badCharacter),
     m_encoding(
         theSource.m_encoding,
-        theSource.getMemoryManager())
+        m_memoryManager)
 {
 }
 

Modified: xalan/c/trunk/src/xalanc/XSLT/ProblemListener.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/ProblemListener.hpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/ProblemListener.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/ProblemListener.hpp Tue Aug  5 12:38:52 2008
@@ -50,14 +50,16 @@
 public:
 
 	/// Sources of problem
-	enum eProblemSource { eXMLPARSER		= 1,
-						  eXSLPROCESSOR		= 2,
-						  eXPATH			= 3 };
+	enum eProblemSource { eXMLPARSER		= 0,
+						  eXSLPROCESSOR		= 1,
+						  eXPATH			= 2,
+                          eSourceCount };
 
 	/// Severity of problem
 	enum eClassification {	eMESSAGE	= 0,
 							eWARNING	= 1,
-							eERROR		= 2 };
+							eERROR		= 2,
+                            eClassificationCount };
 
 	ProblemListener();
 
@@ -75,8 +77,8 @@
 	/**
  	 * Function that is called when a problem event occurs.
      * 
-     * @param   where          either in XMLPARSER, XSLPROCESSOR, or QUERYENGINE
-     * @param   classification either MESSAGE, ERROR or WARNING
+     * @param   source         either eXMLPARSER, eXSLPROCESSOR, or eXPATH
+     * @param   classification either eMESSAGE, eERROR or eWARNING
 	 * @param   sourceNode     source tree node where the problem occurred
 	 *                         (may be 0)
 	 * @param   styleNode      style tree node where the problem occurred
@@ -88,7 +90,7 @@
 	 */
 	virtual void
 	problem(
-			eProblemSource				where,
+			eProblemSource				source,
 			eClassification				classification,
 			const XalanNode*			sourceNode,
 			const ElemTemplateElement*	styleNode,

Modified: xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp Tue Aug  5 12:38:52 2008
@@ -30,6 +30,7 @@
 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
 #include <xalanc/PlatformSupport/PrintWriter.hpp>
 #include <xalanc/PlatformSupport/XalanMessageLoader.hpp>
+#include <xalanc/PlatformSupport/XSLException.hpp>
 
 
 
@@ -41,60 +42,25 @@
 
 
 
-static const XalanDOMChar   xsltHeader[] =
+static const XalanMessages::Codes s_messageCodes[ProblemListener::eSourceCount][ProblemListener::eClassificationCount] =
 {
-    XalanUnicode::charLetter_X,
-    XalanUnicode::charLetter_S,
-    XalanUnicode::charLetter_L,
-    XalanUnicode::charLetter_T,
-    XalanUnicode::charSpace,
-    0
-};
-
-static const XalanDOMChar   xmlHeader[] =
-{
-    XalanUnicode::charLetter_X,
-    XalanUnicode::charLetter_M,
-    XalanUnicode::charLetter_L,
-    XalanUnicode::charSpace,
-    0
-};
-
-static const XalanDOMChar   xpathHeader[] =
-{
-    XalanUnicode::charLetter_X,
-    XalanUnicode::charLetter_P,
-    XalanUnicode::charLetter_a,
-    XalanUnicode::charLetter_t,
-    XalanUnicode::charLetter_h,
-    XalanUnicode::charSpace,
-    0
-};
-
-static const XalanDOMChar   uriHeader[] =
-{
-    0
-};
-
-static const XalanDOMChar   uriSeparator[] =
-{
-    XalanUnicode::charComma,
-    XalanUnicode::charSpace,
-    0
+    {
+        XalanMessages::XMLMessage,
+        XalanMessages::XMLWarning,
+        XalanMessages::XMLError,
+    },
+    {
+        XalanMessages::XSLTMessage,
+        XalanMessages::XSLTWarning,
+        XalanMessages::XSLTError,
+    },
+    {
+        XalanMessages::XPathMessage,
+        XalanMessages::XPathWarning,
+        XalanMessages::XPathError,
+    }
 };
 
-static const XalanDOMChar   locationOpen[] =
-{
-    XalanUnicode::charSpace,
-    XalanUnicode::charLeftParenthesis,
-    0
-};
-
-static const XalanDOMChar   locationClose[] =
-{
-    XalanUnicode::charRightParenthesis,
-    0
-};
 
 
 ProblemListenerDefault::ProblemListenerDefault(
@@ -103,7 +69,6 @@
     ProblemListener(),
     m_memoryManager(theManager),
     m_pw(pw)
-
 {
 }
 
@@ -125,7 +90,7 @@
 
 void
 ProblemListenerDefault::problem(
-            eProblemSource              where,
+            eProblemSource              source,
             eClassification             classification,
             const XalanNode*            sourceNode,
             const ElemTemplateElement*  styleNode,
@@ -136,7 +101,16 @@
 {
     if (m_pw != 0)
     {
-        problem(*m_pw, where, classification, sourceNode, styleNode, msg, uri, lineNo, charOffset);
+        problem(
+            *m_pw,
+            source,
+            classification,
+            sourceNode,
+            styleNode,
+            msg,
+            uri,
+            lineNo,
+            charOffset);
     }
 }
 
@@ -145,7 +119,7 @@
 void
 ProblemListenerDefault::problem(
             PrintWriter&                pw,
-            eProblemSource              where,
+            eProblemSource              source,
             eClassification             classification,
             const XalanNode*            sourceNode,
             const ElemTemplateElement*  styleNode,
@@ -154,50 +128,32 @@
 			XalanFileLoc				lineNo,
 			XalanFileLoc				charOffset)
 {
-    MemoryManagerType& theManager = pw.getMemoryManager();
+    MemoryManager&  theManager = pw.getMemoryManager();
 
-    if (eXMLPARSER == where)
-    {
-        pw.print(xmlHeader);
-    }
-    else if (eXPATH == where)
-    {
-        pw.print(xpathHeader);
-    }
-    else
-    {
-        pw.print(xsltHeader);
-    }
+    XalanDOMString  theTypeBuffer(theManager);
+
+    XalanMessageLoader::getMessage(
+        theTypeBuffer,
+        s_messageCodes[source][classification]);
 
     XalanDOMString  theBuffer(theManager);
 
-    if (eERROR == classification)
-    {
-        XalanMessageLoader::getMessage(
-            theBuffer,
-            XalanMessages::Error_1Param,
-            msg);
-    }
-    else if (eWARNING == classification)
-    {
-        XalanMessageLoader::getMessage(
-            theBuffer,
-            XalanMessages::Warning_1Param,
-            msg);
-    }
-    else
-    {
-        XalanMessageLoader::getMessage(
-            theBuffer,
-            XalanMessages::Message_1Param,
-            msg);
-    }
+    XSLException::defaultFormat(
+        msg.c_str(),
+        msg.length(),
+        uri,
+        uri == 0 ? 0 : length(uri),
+        lineNo,
+        charOffset,
+        theTypeBuffer.c_str(),
+        theTypeBuffer.length(),
+        theBuffer);
 
     pw.println(theBuffer);
 
     if (0 != styleNode)
     {
-        pw.print(
+        pw.println(
             XalanMessageLoader::getMessage(
                 theBuffer, 
                 XalanMessages::StyleTreeNode_1Param,
@@ -206,38 +162,12 @@
 
     if (0 != sourceNode)
     {
-        pw.print(
+        pw.println(
             XalanMessageLoader::getMessage(
                 theBuffer,
                 XalanMessages::SourceTreeNode_1Param,
                 sourceNode->getNodeName()));
     }
-
-    pw.print(locationOpen);
-
-    if (0 != uri)
-    {
-        pw.print(uri);
-        pw.print(uriSeparator);
-    }
-
-    XalanDOMString  lineNoString(theManager);
-    NumberToDOMString(lineNo, lineNoString);
-
-    XalanDOMString  charOffsetString(theManager);
-    NumberToDOMString(charOffset, charOffsetString);
-
-    XalanMessageLoader::getMessage(
-        theBuffer,
-        XalanMessages::LineNumberColumnNumber_2Params,
-        lineNoString,
-        charOffsetString);
-
-    pw.print(theBuffer);
-
-    pw.print(locationClose);
-
-    pw.println();
 }
 
 

Modified: xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.hpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.hpp Tue Aug  5 12:38:52 2008
@@ -41,8 +41,9 @@
 {
 public:
 
-	ProblemListenerDefault(MemoryManagerType& theManager, 
-                            PrintWriter*		pw = 0);
+	ProblemListenerDefault(
+            MemoryManager&  theManager, 
+            PrintWriter*    pw = 0);
 
 	virtual
 	~ProblemListenerDefault();
@@ -54,7 +55,7 @@
 
 	virtual void
 	problem(
-			eProblemSource				where,
+			eProblemSource				source,
 			eClassification				classification, 
 			const XalanNode*			sourceNode,
 			const ElemTemplateElement*	styleNode,
@@ -74,7 +75,7 @@
 	static void
 	problem(
 			PrintWriter&				pw,
-			eProblemSource				where,
+			eProblemSource				source,
 			eClassification				classification,
 			const XalanNode*			sourceNode,
 			const ElemTemplateElement*	styleNode,
@@ -85,9 +86,9 @@
 
 private:
 
-    MemoryManagerType&  m_memoryManager;
+    MemoryManager&  m_memoryManager;
 
-	PrintWriter*	    m_pw;
+	PrintWriter*	m_pw;
 };
 
 

Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.cpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.cpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.cpp Tue Aug  5 12:38:52 2008
@@ -15,10 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- * 
- * @author David N. Bertoni (david_n_bertoni@lotus.com)
- * */
 
 
 
@@ -73,7 +69,7 @@
 
 void
 XalanTransformerProblemListener::problem(
-			eProblemSource				where,
+			eProblemSource				source,
 			eClassification				classification, 
 			const XalanNode*			sourceNode,
 			const ElemTemplateElement*	styleNode,
@@ -85,7 +81,7 @@
 	if (classification == eERROR)
 	{
 		m_problemListener.problem(
-			where,
+			source,
 			classification,
 			sourceNode,
 			styleNode,
@@ -102,7 +98,7 @@
 
 		ProblemListenerDefault::problem(
 			thePrintWriter,
-			where,
+			source,
 			classification,
 			sourceNode,
 			styleNode,

Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.hpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.hpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanTransformerProblemListener.hpp Tue Aug  5 12:38:52 2008
@@ -68,7 +68,7 @@
 
 	virtual void
 	problem(
-			eProblemSource				where,
+			eProblemSource				source,
 			eClassification				classification,
 			const XalanNode*			sourceNode,
 			const ElemTemplateElement*	styleNode,

Modified: xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp?rev=682895&r1=682894&r2=682895&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp (original)
+++ xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp Tue Aug  5 12:38:52 2008
@@ -48,6 +48,7 @@
 #include <xalanc/PlatformSupport/ExecutionContext.hpp>
 #include <xalanc/PlatformSupport/XalanMessageLoader.hpp>
 #include <xalanc/PlatformSupport/XalanUnicode.hpp>
+#include <xalanc/PlatformSupport/XSLException.hpp>
 
 
 
@@ -687,42 +688,23 @@
             const SAXParseExceptionType&    e,
             XalanDOMString&                 theMessage)
 {
+    XalanDOMString  theErrorBuffer(theMessage.getMemoryManager());
 
-    const XalanDOMChar* const   theSystemID = e.getSystemId();
-
-    XalanDOMString  theLineNumber(theMessage.getMemoryManager());
-    XalanDOMString  theColumnNumb(theMessage.getMemoryManager());
-
-    NumberToDOMString(e.getLineNumber(), theLineNumber);
-    NumberToDOMString(e.getColumnNumber(), theColumnNumb);
+    const XalanDOMChar* const   theExceptionMessage = e.getMessage();
+    assert(theExceptionMessage != 0);
 
-    XalanDOMString  theErrorMsg(theMessage.getMemoryManager());
-
-    if (theSystemID == 0 || length(theSystemID) == 0)
-    {
-        
-        append(
-            theMessage,
-            XalanMessageLoader::getMessage(
-                theErrorMsg,
-                XalanMessages::AtUnknownFileLineColumn_2Param,
-            theLineNumber,
-            theColumnNumb));
-    }
-    else
-    {
-        append(
-            theMessage,
-            XalanMessageLoader::getMessage(
-                theErrorMsg,
-                XalanMessages::AtFileLineColumn_3Param,
-                XalanDOMString(theSystemID, theMessage.getMemoryManager()),
-            theLineNumber,
-            theColumnNumb));
-    }
+    const XalanDOMChar* const   theSystemID = e.getSystemId();
 
-    append(theMessage, XalanDOMChar(XalanUnicode::charSpace));
-    append(theMessage, e.getMessage());
+    XSLException::defaultFormat(
+        theExceptionMessage,
+        length(theExceptionMessage),
+        theSystemID,
+        theSystemID == 0 ? 0 : length(theSystemID),
+        e.getLineNumber(),
+        e.getColumnNumber(),
+        0,
+        0,
+        theMessage);
 }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org