cargilld 2004/09/02 07:59:30 Modified: c/samples/CreateDOMDocument CreateDOMDocument.cpp c/samples/DOMPrint DOMPrint.cpp c/samples/EnumVal EnumVal.cpp c/samples/MemParse MemParse.cpp c/samples/PParse PParse.cpp c/samples/PSVIWriter PSVIWriter.cpp c/samples/Redirect Redirect.cpp c/samples/SAX2Count SAX2Count.cpp c/samples/SAX2Print SAX2Print.cpp c/samples/SAXCount SAXCount.cpp c/samples/SAXPrint SAXPrint.cpp c/samples/SCMPrint SCMPrint.cpp c/samples/SEnumVal SEnumVal.cpp c/samples/StdInParse StdInParse.cpp Log: Add OutOfMemoryException block to samples. Revision Changes Path 1.19 +7 -2 xml-xerces/c/samples/CreateDOMDocument/CreateDOMDocument.cpp Index: CreateDOMDocument.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/CreateDOMDocument/CreateDOMDocument.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- CreateDOMDocument.cpp 10 Dec 2003 23:48:53 -0000 1.18 +++ CreateDOMDocument.cpp 2 Sep 2004 14:59:28 -0000 1.19 @@ -75,6 +75,7 @@ #else #include <iostream.h> #endif +#include <xercesc/util/OutOfMemoryException.hpp> XERCES_CPP_NAMESPACE_USE @@ -213,7 +214,11 @@ doc->release(); } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCode = 5; + } catch (const DOMException& e) { XERCES_STD_QUALIFIER cerr << "DOMException code is: " << e.code << XERCES_STD_QUALIFIER endl; 1.60 +12 -2 xml-xerces/c/samples/DOMPrint/DOMPrint.cpp Index: DOMPrint.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/DOMPrint/DOMPrint.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- DOMPrint.cpp 6 Feb 2004 15:04:16 -0000 1.59 +++ DOMPrint.cpp 2 Sep 2004 14:59:28 -0000 1.60 @@ -120,6 +120,7 @@ #include "DOMTreeErrorReporter.hpp" #include "DOMPrintFilter.hpp" #include "DOMPrintErrorHandler.hpp" +#include <xercesc/util/OutOfMemoryException.hpp> #include <string.h> #include <stdlib.h> @@ -430,7 +431,11 @@ { parser->parse(gXmlFile); } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorsOccured = true; + } catch (const XMLException& e) { XERCES_STD_QUALIFIER cerr << "An error occurred during parsing\n Message: " @@ -541,6 +546,11 @@ if (gUseFilter) delete myFilter; + } + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + retval = 5; } catch (XMLException& e) { 1.22 +9 -1 xml-xerces/c/samples/EnumVal/EnumVal.cpp Index: EnumVal.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/EnumVal/EnumVal.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- EnumVal.cpp 7 Aug 2003 21:21:38 -0000 1.21 +++ EnumVal.cpp 2 Sep 2004 14:59:28 -0000 1.22 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.22 2004/09/02 14:59:28 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.21 2003/08/07 21:21:38 neilg * fix segmentation faults that may arise when the parser throws exceptions during document parsing. In general, XMLPlatformUtils::Terminate() should not be called from within a catch statement. * @@ -132,6 +135,7 @@ #include <xercesc/framework/XMLValidator.hpp> #include <xercesc/parsers/SAXParser.hpp> #include <xercesc/validators/DTD/DTDValidator.hpp> +#include <xercesc/util/OutOfMemoryException.hpp> #if defined(XERCES_NEW_IOSTREAMS) #include <iostream> #else @@ -271,7 +275,11 @@ parser->parse(xmlFile); errorCount = parser->getErrorCount(); } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCode = 5; + } catch (const XMLException& e) { XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << xmlFile << "'\n" 1.17 +9 -2 xml-xerces/c/samples/MemParse/MemParse.cpp Index: MemParse.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/MemParse/MemParse.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- MemParse.cpp 12 Sep 2003 18:14:19 -0000 1.16 +++ MemParse.cpp 2 Sep 2004 14:59:28 -0000 1.17 @@ -57,6 +57,9 @@ /* * $Log$ + * Revision 1.17 2004/09/02 14:59:28 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.16 2003/09/12 18:14:19 neilg * enable MemParse to work on OS400; thanks to Jay Hansen. * @@ -132,7 +135,7 @@ #include <xercesc/parsers/SAXParser.hpp> #include <xercesc/framework/MemBufInputSource.hpp> #include "MemParse.hpp" - +#include <xercesc/util/OutOfMemoryException.hpp> // --------------------------------------------------------------------------- // Local const data @@ -334,7 +337,11 @@ duration = endMillis - startMillis; errorCount = parser->getErrorCount(); } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCode = 5; + } catch (const XMLException& e) { XERCES_STD_QUALIFIER cerr << "\nError during parsing memory stream:\n" 1.17 +9 -2 xml-xerces/c/samples/PParse/PParse.cpp Index: PParse.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/PParse/PParse.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- PParse.cpp 7 Aug 2003 21:21:38 -0000 1.16 +++ PParse.cpp 2 Sep 2004 14:59:29 -0000 1.17 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.17 2004/09/02 14:59:29 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.16 2003/08/07 21:21:38 neilg * fix segmentation faults that may arise when the parser throws exceptions during document parsing. In general, XMLPlatformUtils::Terminate() should not be called from within a catch statement. * @@ -146,7 +149,7 @@ #include <xercesc/framework/XMLPScanToken.hpp> #include <xercesc/parsers/SAXParser.hpp> #include "PParse.hpp" - +#include <xercesc/util/OutOfMemoryException.hpp> // --------------------------------------------------------------------------- // Local data @@ -348,7 +351,11 @@ // parser->parseReset(token); } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCode = 5; + } catch (const XMLException& toCatch) { XERCES_STD_QUALIFIER cerr << "\nAn error occurred: '" << xmlFile << "'\n" 1.4 +10 -1 xml-xerces/c/samples/PSVIWriter/PSVIWriter.cpp Index: PSVIWriter.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/PSVIWriter/PSVIWriter.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- PSVIWriter.cpp 10 Feb 2004 17:36:38 -0000 1.3 +++ PSVIWriter.cpp 2 Sep 2004 14:59:29 -0000 1.4 @@ -57,6 +57,9 @@ //REVISIT /* * $Log$ + * Revision 1.4 2004/09/02 14:59:29 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.3 2004/02/10 17:36:38 cargilld * Fix build problems. * @@ -83,6 +86,7 @@ #include <xercesc/util/XMLString.hpp> #include <xercesc/sax2/SAX2XMLReader.hpp> #include <xercesc/sax2/XMLReaderFactory.hpp> +#include <xercesc/util/OutOfMemoryException.hpp> #if defined(XERCES_NEW_IOSTREAMS) #include <fstream> @@ -347,7 +351,12 @@ const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis(); duration = endMillis - startMillis; } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorOccurred = true; + continue; + } catch (const XMLException& e) { XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << xmlFile << "'\n" 1.10 +9 -2 xml-xerces/c/samples/Redirect/Redirect.cpp Index: Redirect.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/Redirect/Redirect.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Redirect.cpp 7 Aug 2003 21:21:38 -0000 1.9 +++ Redirect.cpp 2 Sep 2004 14:59:29 -0000 1.10 @@ -75,6 +75,9 @@ * to read the contents of 'personal.dtd'. * * $Log$ + * Revision 1.10 2004/09/02 14:59:29 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.9 2003/08/07 21:21:38 neilg * fix segmentation faults that may arise when the parser throws exceptions during document parsing. In general, XMLPlatformUtils::Terminate() should not be called from within a catch statement. * @@ -114,7 +117,7 @@ // --------------------------------------------------------------------------- #include <xercesc/parsers/SAXParser.hpp> #include "Redirect.hpp" - +#include <xercesc/util/OutOfMemoryException.hpp> // --------------------------------------------------------------------------- // Local helper methods @@ -190,7 +193,11 @@ duration = endMillis - startMillis; errorCount = parser->getErrorCount(); } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCode = 5; + } catch (const XMLException& e) { XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << xmlFile << "'\n" 1.28 +10 -1 xml-xerces/c/samples/SAX2Count/SAX2Count.cpp Index: SAX2Count.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/SAX2Count/SAX2Count.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- SAX2Count.cpp 13 Apr 2004 19:40:47 -0000 1.27 +++ SAX2Count.cpp 2 Sep 2004 14:59:29 -0000 1.28 @@ -56,6 +56,9 @@ /* * $Log$ +* Revision 1.28 2004/09/02 14:59:29 cargilld +* Add OutOfMemoryException block to samples. +* * Revision 1.27 2004/04/13 19:40:47 peiyongz * usage * @@ -154,6 +157,7 @@ #else #include <fstream.h> #endif +#include <xercesc/util/OutOfMemoryException.hpp> // --------------------------------------------------------------------------- // Local helper methods @@ -411,7 +415,12 @@ const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis(); duration = endMillis - startMillis; } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorOccurred = true; + continue; + } catch (const XMLException& e) { XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << xmlFile << "'\n" 1.16 +9 -2 xml-xerces/c/samples/SAX2Print/SAX2Print.cpp Index: SAX2Print.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/SAX2Print/SAX2Print.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- SAX2Print.cpp 6 Feb 2004 15:04:16 -0000 1.15 +++ SAX2Print.cpp 2 Sep 2004 14:59:29 -0000 1.16 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.16 2004/09/02 14:59:29 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.15 2004/02/06 15:04:16 cargilld * Misc 390 changes. * @@ -114,7 +117,7 @@ #include <xercesc/sax2/SAX2XMLReader.hpp> #include <xercesc/sax2/XMLReaderFactory.hpp> #include "SAX2Print.hpp" - +#include <xercesc/util/OutOfMemoryException.hpp> // --------------------------------------------------------------------------- // Local data @@ -350,7 +353,11 @@ parser->parse(xmlFile); errorCount = parser->getErrorCount(); } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCode = 5; + } catch (const XMLException& toCatch) { XERCES_STD_QUALIFIER cerr << "\nAn error occurred\n Error: " 1.29 +10 -3 xml-xerces/c/samples/SAXCount/SAXCount.cpp Index: SAXCount.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/SAXCount/SAXCount.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- SAXCount.cpp 30 May 2003 09:36:36 -0000 1.28 +++ SAXCount.cpp 2 Sep 2004 14:59:29 -0000 1.29 @@ -56,6 +56,9 @@ /* * $Log$ +* Revision 1.29 2004/09/02 14:59:29 cargilld +* Add OutOfMemoryException block to samples. +* * Revision 1.28 2003/05/30 09:36:36 gareth * Use new macros for iostream.h and std:: issues. * @@ -165,8 +168,7 @@ #else #include <fstream.h> #endif - - +#include <xercesc/util/OutOfMemoryException.hpp> // --------------------------------------------------------------------------- // Local helper methods @@ -397,7 +399,12 @@ const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis(); duration = endMillis - startMillis; } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorOccurred = true; + continue; + } catch (const XMLException& e) { XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << xmlFile << "'\n" 1.24 +10 -3 xml-xerces/c/samples/SAXPrint/SAXPrint.cpp Index: SAXPrint.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/SAXPrint/SAXPrint.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- SAXPrint.cpp 6 Feb 2004 15:04:16 -0000 1.23 +++ SAXPrint.cpp 2 Sep 2004 14:59:29 -0000 1.24 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.24 2004/09/02 14:59:29 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.23 2004/02/06 15:04:16 cargilld * Misc 390 changes. * @@ -148,7 +151,7 @@ #include <xercesc/util/TransService.hpp> #include <xercesc/parsers/SAXParser.hpp> #include "SAXPrint.hpp" - +#include <xercesc/util/OutOfMemoryException.hpp> // --------------------------------------------------------------------------- // Local data @@ -354,13 +357,17 @@ parser->parse(xmlFile); errorCount = parser->getErrorCount(); } - + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCode = 5; + } catch (const XMLException& toCatch) { XERCES_STD_QUALIFIER cerr << "\nAn error occurred\n Error: " << StrX(toCatch.getMessage()) << "\n" << XERCES_STD_QUALIFIER endl; - errorCode = -1; + errorCode = 4; } if(errorCode) { XMLPlatformUtils::Terminate(); 1.3 +9 -1 xml-xerces/c/samples/SCMPrint/SCMPrint.cpp Index: SCMPrint.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/SCMPrint/SCMPrint.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SCMPrint.cpp 12 Feb 2004 13:58:58 -0000 1.2 +++ SCMPrint.cpp 2 Sep 2004 14:59:29 -0000 1.3 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.3 2004/09/02 14:59:29 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.2 2004/02/12 13:58:58 cargilld * Fix build errors. * @@ -87,7 +90,7 @@ #endif #include <stdlib.h> #include <string.h> - +#include <xercesc/util/OutOfMemoryException.hpp> XERCES_CPP_NAMESPACE_USE @@ -319,6 +322,11 @@ XERCES_STD_QUALIFIER cout << "No XSModel to print" << "\n\n"; } XERCES_STD_QUALIFIER cout << XERCES_STD_QUALIFIER endl; + } + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException during parsing: '" << xsdFile << "'\n" << XERCES_STD_QUALIFIER endl; + errorCode = 6; } catch (const XMLException& e) { 1.18 +10 -1 xml-xerces/c/samples/SEnumVal/SEnumVal.cpp Index: SEnumVal.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/SEnumVal/SEnumVal.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- SEnumVal.cpp 7 Aug 2003 21:21:38 -0000 1.17 +++ SEnumVal.cpp 2 Sep 2004 14:59:30 -0000 1.18 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.18 2004/09/02 14:59:30 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.17 2003/08/07 21:21:38 neilg * fix segmentation faults that may arise when the parser throws exceptions during document parsing. In general, XMLPlatformUtils::Terminate() should not be called from within a catch statement. * @@ -116,6 +119,7 @@ #include <xercesc/validators/schema/SchemaValidator.hpp> #include <xercesc/validators/common/ContentSpecNode.hpp> #include <xercesc/validators/schema/SchemaSymbols.hpp> +#include <xercesc/util/OutOfMemoryException.hpp> #if defined(XERCES_NEW_IOSTREAMS) #include <iostream> #else @@ -236,6 +240,11 @@ try { process(argV[1]); + } + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCode = 5; } catch (const XMLException& e) { 1.16 +10 -1 xml-xerces/c/samples/StdInParse/StdInParse.cpp Index: StdInParse.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/samples/StdInParse/StdInParse.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- StdInParse.cpp 30 May 2003 09:36:36 -0000 1.15 +++ StdInParse.cpp 2 Sep 2004 14:59:30 -0000 1.16 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.16 2004/09/02 14:59:30 cargilld + * Add OutOfMemoryException block to samples. + * * Revision 1.15 2003/05/30 09:36:36 gareth * Use new macros for iostream.h and std:: issues. * @@ -116,7 +119,7 @@ #include <xercesc/framework/StdInInputSource.hpp> #include <xercesc/parsers/SAXParser.hpp> #include "StdInParse.hpp" - +#include <xercesc/util/OutOfMemoryException.hpp> // --------------------------------------------------------------------------- // Local data @@ -276,6 +279,12 @@ const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis(); duration = endMillis - startMillis; errorCount = parser->getErrorCount(); + } + catch (const OutOfMemoryException&) + { + XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; + errorCount = 2; + return 4; } catch (const XMLException& e) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]