You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2004/09/02 17:11:42 UTC

cvs commit: xml-xerces/c/tests/MemHandlerTest MemoryMonitor.cpp

cargilld    2004/09/02 08:11:42

  Modified:    c/tests/DOM/DeprecatedDOMCount DeprecatedDOMCount.cpp
               c/tests/DOM/DOMTest DTest.cpp
               c/tests/EncodingTest EncodingTest.cpp
               c/tests/InitTermTest InitTermTest.cpp
               c/tests/MemHandlerTest MemoryMonitor.cpp
  Log:
  Add OutOfMemoryException block to tests.
  
  Revision  Changes    Path
  1.7       +8 -3      xml-xerces/c/tests/DOM/DeprecatedDOMCount/DeprecatedDOMCount.cpp
  
  Index: DeprecatedDOMCount.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tests/DOM/DeprecatedDOMCount/DeprecatedDOMCount.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DeprecatedDOMCount.cpp	30 May 2003 13:08:24 -0000	1.6
  +++ DeprecatedDOMCount.cpp	2 Sep 2004 15:11:41 -0000	1.7
  @@ -75,7 +75,7 @@
   #else
   #include <fstream.h>
   #endif
  -
  +#include <xercesc/util/OutOfMemoryException.hpp>
   
   
   // ---------------------------------------------------------------------------
  @@ -272,7 +272,12 @@
               const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
               duration = endMillis - startMillis;
           }
  -
  +        catch (const OutOfMemoryException&)
  +        {
  +            XERCES_STD_QUALIFIER cerr << "OutOfMemoryException during parsing: '" << xmlFile << "'\n" << XERCES_STD_QUALIFIER endl;
  +            errorOccurred = true;
  +            continue;
  +        }
           catch (const XMLException& toCatch)
           {
               XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << xmlFile << "'\n"
  
  
  
  1.41      +9 -1      xml-xerces/c/tests/DOM/DOMTest/DTest.cpp
  
  Index: DTest.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tests/DOM/DOMTest/DTest.cpp,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- DTest.cpp	2 Mar 2004 13:53:50 -0000	1.40
  +++ DTest.cpp	2 Sep 2004 15:11:42 -0000	1.41
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.41  2004/09/02 15:11:42  cargilld
  + * Add OutOfMemoryException block to tests.
  + *
    * Revision 1.40  2004/03/02 13:53:50  amassari
    * Added test for bug# 26919
    *
  @@ -157,6 +160,7 @@
   #include <xercesc/util/XMLString.hpp>
   #include <xercesc/parsers/XercesDOMParser.hpp>
   #include <xercesc/dom/DOMException.hpp>
  +#include <xercesc/util/OutOfMemoryException.hpp>
   
   #define EXCEPTIONSTEST(operation, expectedException, resultFlag, testNum) \
       {                                                               \
  @@ -4542,7 +4546,11 @@
           // please modify if this is not correct
           parser->parse("personal-schema.xml");
       }
  -
  +    catch (const OutOfMemoryException&)
  +    {
  +	    fprintf(stderr, "OutOfMemoryException.\n");        
  +	    return false;
  +    }
       catch (...) {
           fprintf(stderr, "parsing personal-schema.xml failed at line %i\n", __LINE__);
           return false;
  
  
  
  1.11      +6 -2      xml-xerces/c/tests/EncodingTest/EncodingTest.cpp
  
  Index: EncodingTest.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tests/EncodingTest/EncodingTest.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EncodingTest.cpp	5 Feb 2003 18:55:21 -0000	1.10
  +++ EncodingTest.cpp	2 Sep 2004 15:11:42 -0000	1.11
  @@ -74,7 +74,7 @@
   #include <xercesc/sax/ErrorHandler.hpp>
   #include <xercesc/sax/SAXParseException.hpp>
   
  -
  +#include <xercesc/util/OutOfMemoryException.hpp>
   #include <xercesc/parsers/XercesDOMParser.hpp>
   #include <xercesc/dom/DOM.hpp>
   #include <stdio.h>
  @@ -167,7 +167,11 @@
       {
           parser->parse(fileName);
       }
  -
  +    catch (const OutOfMemoryException&)
  +    {
  +	    fprintf(stderr, "OutOfMemoryException during parsing: %s\n", fileName);        
  +	    return 0;
  +    }
       catch (const XMLException& e )
       {
   		fprintf(stderr, "Exception Occurred \"%s\".  \n",
  
  
  
  1.8       +7 -3      xml-xerces/c/tests/InitTermTest/InitTermTest.cpp
  
  Index: InitTermTest.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tests/InitTermTest/InitTermTest.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- InitTermTest.cpp	30 May 2003 13:08:25 -0000	1.7
  +++ InitTermTest.cpp	2 Sep 2004 15:11:42 -0000	1.8
  @@ -74,7 +74,7 @@
   #include <xercesc/parsers/SAXParser.hpp>
   #include <xercesc/sax2/SAX2XMLReader.hpp>
   #include <xercesc/sax2/XMLReaderFactory.hpp>
  -
  +#include <xercesc/util/OutOfMemoryException.hpp>
   #include <xercesc/dom/DOMException.hpp>
   #include "InitTermTest.hpp"
   
  @@ -166,7 +166,11 @@
       {                                                             \
           parser->parse(xmlFile);                                   \
       }                                                             \
  -                                                                  \
  +    catch (const OutOfMemoryException&)                           \
  +    {                                                             \
  +        XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl; \
  +        errorOccurred = true;                                     \
  +    }                                                             \
       catch (const XMLException& toCatch)                           \
       {                                                             \
           XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << xmlFile << "'\n"   \
  
  
  
  1.6       +9 -2      xml-xerces/c/tests/MemHandlerTest/MemoryMonitor.cpp
  
  Index: MemoryMonitor.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tests/MemHandlerTest/MemoryMonitor.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MemoryMonitor.cpp	15 Feb 2004 19:43:04 -0000	1.5
  +++ MemoryMonitor.cpp	2 Sep 2004 15:11:42 -0000	1.6
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.6  2004/09/02 15:11:42  cargilld
  + * Add OutOfMemoryException block to tests.
  + *
    * Revision 1.5  2004/02/15 19:43:04  amassari
    * Removed cause for warnings in VC 7.1
    *
  @@ -87,7 +90,7 @@
   #endif
   #include <assert.h>
   #include <xercesc/util/XercesDefs.hpp>
  -
  +#include <xercesc/util/OutOfMemoryException.hpp>
   
   void* MemoryMonitor::allocate(size_t size)
   {
  @@ -425,7 +428,11 @@
                   depDOMParser->parse(xmlFile);
                   saxParser->parse(xmlFile);
               }
  -
  +            catch (const OutOfMemoryException&)
  +            {
  +                XERCES_STD_QUALIFIER cerr << "OutOfMemoryException during parsing: '" << xmlFile << "'\n" << XERCES_STD_QUALIFIER endl;;
  +                continue;
  +            }
               catch (const XMLException& toCatch)
               {
                   char *msg = XMLString::transcode(toCatch.getMessage()); 
  
  
  

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