You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ea...@apache.org on 2007/06/08 16:45:22 UTC

svn commit: r545527 - in /incubator/uima/uimacpp/trunk/src: framework/ framework/uima/ test/src/ utils/

Author: eae
Date: Fri Jun  8 07:45:20 2007
New Revision: 545527

URL: http://svn.apache.org/viewvc?view=rev&rev=545527
Log:
UIMA-423 (Bhavani's 2nd set of patches)

Modified:
    incubator/uima/uimacpp/trunk/src/framework/annotator_context.cpp
    incubator/uima/uimacpp/trunk/src/framework/engine.cpp
    incubator/uima/uimacpp/trunk/src/framework/taespecifierbuilder.cpp
    incubator/uima/uimacpp/trunk/src/framework/uima/engine.hpp
    incubator/uima/uimacpp/trunk/src/test/src/test_cas.cpp
    incubator/uima/uimacpp/trunk/src/test/src/test_casserializer.cpp
    incubator/uima/uimacpp/trunk/src/test/src/test_engine.cpp
    incubator/uima/uimacpp/trunk/src/test/src/test_iterators.cpp
    incubator/uima/uimacpp/trunk/src/utils/runAECpp.cpp

Modified: incubator/uima/uimacpp/trunk/src/framework/annotator_context.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/annotator_context.cpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/annotator_context.cpp (original)
+++ incubator/uima/uimacpp/trunk/src/framework/annotator_context.cpp Fri Jun  8 07:45:20 2007
@@ -613,6 +613,9 @@
   }
 
   void AnnotatorContext::release(vector<std::string*> & returnValues) const {
+    for (int i=0; i < returnValues.size();i++) {
+      delete returnValues.at(i);
+    }
     returnValues.clear();
   }
 

Modified: incubator/uima/uimacpp/trunk/src/framework/engine.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/engine.cpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/engine.cpp (original)
+++ incubator/uima/uimacpp/trunk/src/framework/engine.cpp Fri Jun  8 07:45:20 2007
@@ -313,11 +313,11 @@
       //  Warning: this could cause a memory leak if the createTAE() method coudl not create
       //           the actual engine object.     suhre 02/11/03
       apTAESpecifier.release();
-
       AnalysisEngine * pResult = createAnalysisEngine(* apANC.release(), true,
                                      true,
                                      * apCASDef.release(), true,
                                      rErrorInfo);
+           
       return pResult;
     } catch (Exception & rExc) {
       rErrorInfo = rExc.getErrorInfo();
@@ -380,7 +380,7 @@
       // release auto_ptrs here because the createTAE transfers ownership to the engine
       //  Warning: this could cause a memory leak if the createTAE() method coudl not create (construct)
       //           the actual engine object.     suhre 02/11/03
-      AnalysisEngine * pResult = createAnalysisEngine(*apANC.release(), true,
+       AnalysisEngine * pResult = createAnalysisEngine(*apANC.release(), true,
                                      false,
                                      *apCASDef.release(), true,
                                      rErrorInfo);
@@ -602,6 +602,7 @@
 
 
 /* ----------------------------------------------------------------------- */
+
 
 
 

Modified: incubator/uima/uimacpp/trunk/src/framework/taespecifierbuilder.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/taespecifierbuilder.cpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/taespecifierbuilder.cpp (original)
+++ incubator/uima/uimacpp/trunk/src/framework/taespecifierbuilder.cpp Fri Jun  8 07:45:20 2007
@@ -147,8 +147,27 @@
     }
 
     parser.setErrorHandler(iv_pXMLErrorHandler);
+    try {
+      parser.parse( crInputSource );
+    } catch (XMLException const & e){
+      if (bHasOwnErrorHandler) {
+        delete iv_pXMLErrorHandler;
+        iv_pXMLErrorHandler = NULL; 
+      }
+      ErrorInfo errInfo;
+      errInfo.setErrorId((TyErrorId)UIMA_ERR_RESOURCE_CORRUPTED);
+      ErrorMessage msg(UIMA_MSG_ID_EXC_XML_SAXPARSE_FATALERROR);
+      assertWithMsg(sizeof(XMLCh) == sizeof(UChar), "Port required");
+      msg.addParam( crInputSource.getSystemId() );
+      msg.addParam( 0 );
+      msg.addParam( 0 );
+      msg.addParam( (UChar const *) e.getMessage());
+      errInfo.setMessage(msg);
+      errInfo.setSeverity(ErrorInfo::unrecoverable);
+      ExcIllFormedInputError exc(errInfo);
+      throw exc;
+    }
 
-    parser.parse( crInputSource );
     DOMDocument* doc = parser.getDocument();
     assert(EXISTS(doc));
 
@@ -180,7 +199,27 @@
     }
 
     parser.setErrorHandler(iv_pXMLErrorHandler);
-    parser.parse( crInputSource );
+    try {
+      parser.parse( crInputSource );
+    } catch (XMLException const & e){
+      if (bHasOwnErrorHandler) {
+        delete iv_pXMLErrorHandler;
+        iv_pXMLErrorHandler = NULL; 
+      }
+      ErrorInfo errInfo;
+      errInfo.setErrorId((TyErrorId)UIMA_ERR_RESOURCE_CORRUPTED);
+      ErrorMessage msg(UIMA_MSG_ID_EXC_XML_SAXPARSE_FATALERROR);
+      assertWithMsg(sizeof(XMLCh) == sizeof(UChar), "Port required");
+      msg.addParam( crInputSource.getSystemId() );
+      msg.addParam( 0 );
+      msg.addParam( 0 );
+      msg.addParam( (UChar const *) e.getMessage());
+      errInfo.setMessage(msg);
+      errInfo.setSeverity(ErrorInfo::unrecoverable);
+      ExcIllFormedInputError exc(errInfo);
+      throw exc;
+    }
+
 
     DOMDocument* doc = parser.getDocument();
     assert(EXISTS(doc));
@@ -216,7 +255,27 @@
       bHasOwnErrorHandler = true;
     }
     parser.setErrorHandler(iv_pXMLErrorHandler);
+    try {
     parser.parse( crInputSource );
+    } catch (XMLException const & e){
+      if (bHasOwnErrorHandler) {
+        delete iv_pXMLErrorHandler;
+        iv_pXMLErrorHandler = NULL; 
+      }
+      ErrorInfo errInfo;
+      errInfo.setErrorId((TyErrorId)UIMA_ERR_RESOURCE_CORRUPTED);
+      ErrorMessage msg(UIMA_MSG_ID_EXC_XML_SAXPARSE_FATALERROR);
+      assertWithMsg(sizeof(XMLCh) == sizeof(UChar), "Port required");
+      msg.addParam( crInputSource.getSystemId() );
+      msg.addParam( 0 );
+      msg.addParam( 0 );
+      msg.addParam( (UChar const *) e.getMessage());
+      errInfo.setMessage(msg);
+      errInfo.setSeverity(ErrorInfo::unrecoverable);
+      ExcIllFormedInputError exc(errInfo);
+      throw exc;
+    }
+
     DOMDocument* doc = parser.getDocument();
     // get top node
     DOMElement * descElem = doc->getDocumentElement();
@@ -247,8 +306,27 @@
     }
 
     parser.setErrorHandler(iv_pXMLErrorHandler);
+    try {
+      parser.parse( crInputSource );
+    } catch (XMLException const & e){
+      if (bHasOwnErrorHandler) {
+        delete iv_pXMLErrorHandler;
+        iv_pXMLErrorHandler = NULL; 
+      }
+      ErrorInfo errInfo;
+      errInfo.setErrorId((TyErrorId)UIMA_ERR_RESOURCE_CORRUPTED);
+      ErrorMessage msg(UIMA_MSG_ID_EXC_XML_SAXPARSE_FATALERROR);
+      assertWithMsg(sizeof(XMLCh) == sizeof(UChar), "Port required");
+      msg.addParam( crInputSource.getSystemId() );
+      msg.addParam( 0 );
+      msg.addParam( 0 );
+      msg.addParam( (UChar const *) e.getMessage());
+      errInfo.setMessage(msg);
+      errInfo.setSeverity(ErrorInfo::unrecoverable);
+      ExcIllFormedInputError exc(errInfo);
+      throw exc;
+    }
 
-    parser.parse( crInputSource );
     DOMDocument* doc = parser.getDocument();
     // get top node
     DOMElement * descElem = doc->getDocumentElement();
@@ -281,7 +359,27 @@
     }
 
     parser.setErrorHandler(iv_pXMLErrorHandler);
+    try {
     parser.parse( crInputSource );
+    } catch (XMLException const & e){
+      if (bHasOwnErrorHandler) {
+        delete iv_pXMLErrorHandler;
+        iv_pXMLErrorHandler = NULL; 
+      }
+      ErrorInfo errInfo;
+      errInfo.setErrorId((TyErrorId)UIMA_ERR_RESOURCE_CORRUPTED);
+      ErrorMessage msg(UIMA_MSG_ID_EXC_XML_SAXPARSE_FATALERROR);
+      assertWithMsg(sizeof(XMLCh) == sizeof(UChar), "Port required");
+      msg.addParam( crInputSource.getSystemId());
+      msg.addParam( 0 );
+      msg.addParam( 0 );
+      msg.addParam( (UChar const *) e.getMessage());
+      errInfo.setMessage(msg);
+      errInfo.setSeverity(ErrorInfo::unrecoverable);
+      ExcIllFormedInputError exc(errInfo);
+      throw exc;
+    }
+
     DOMDocument* doc = parser.getDocument();
     // get top node
     DOMElement * descElem = doc->getDocumentElement();

Modified: incubator/uima/uimacpp/trunk/src/framework/uima/engine.hpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/uima/engine.hpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/uima/engine.hpp (original)
+++ incubator/uima/uimacpp/trunk/src/framework/uima/engine.hpp Fri Jun  8 07:45:20 2007
@@ -592,12 +592,15 @@
 
 
     /*@}*/
-
+    
 
     /**
      * create a AnalysisEngine from an AnalysisEngineDescription. Returns NULL if creation failed.
      * In such a case, <code>errorInfo</code> contains information about possible errors
      * (output parameter).
+     * The createAnalysisEngine functions could cause a memory leak if it 
+     * fails because these methods use auto ptrs which are released prior
+     * to engine initialization.
      */
     static AnalysisEngine * createAnalysisEngine(AnalysisEngineDescription &, ErrorInfo& errorInfo);
 
@@ -605,6 +608,9 @@
      * create a AnalysisEngine from the name of configuration file. Returns NULL if creation failed.
      * In such a case, <code>errorInfo</code> contains information about possible errors
      * (output parameter).
+     * The createAnalysisEngine functions could cause a memory leak if it 
+     * fails because these methods use auto ptrs which are released prior
+     * to engine initialization.
      */
     static AnalysisEngine * createAnalysisEngine(char const * cpConfigFileName, ErrorInfo& errorInfo);
 
@@ -612,6 +618,9 @@
      * create a TextAnalysisEngine from an in-memory XML Buffer. Returns NULL if creation failed.
      * In such a case, <code>errorInfo</code> contains information about possible errors
      * (output parameter).
+     * The createAnalysisEngine functions could cause a memory leak if it 
+     * fails because these methods use auto ptrs which are released prior
+     * to engine initialization.
      */
     static AnalysisEngine * createAnalysisEngine(UChar const * cpBuffer, size_t uiLength, ErrorInfo& errorInfo);
 
@@ -619,6 +628,9 @@
 	/**
      * Creates a TAE from a file name if the first argument is true or 
      * an XML buffer if false.
+     * The createAnalysisEngine functions could cause a memory leak if it 
+     * fails because these methods use auto ptrs which are released prior
+     * to engine initialization.
      */
     static AnalysisEngine * createAnalysisEngine(bool isFile,
                                           icu::UnicodeString const &,
@@ -626,6 +638,9 @@
 
     /**
      * A lower level API for creating a TextAnalysisEngine
+     * The createAnalysisEngine functions could cause a memory leak if it 
+     * fails because these methods use auto ptrs which are released prior
+     * to engine initialization.
      */
     static AnalysisEngine * createAnalysisEngine(AnnotatorContext & rANC, bool bOwnsANC,
                                           bool bOwnsTAESpecifier,
@@ -643,5 +658,6 @@
 #endif /* UIMA_ENGINE_HPP */
 
 /* <EOF> */
+
 
 

Modified: incubator/uima/uimacpp/trunk/src/test/src/test_cas.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_cas.cpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_cas.cpp (original)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_cas.cpp Fri Jun  8 07:45:20 2007
@@ -181,7 +181,7 @@
           : CASDefinition(NULL) {}
 
 
-      ~TTDefinition() {}
+      ~TTDefinition()   { }
 
       void commitTypeSystem() {
         CASDefinition::commitTypeSystem();
@@ -196,9 +196,9 @@
   }
 }
 
-uima::internal::CASImpl & getCASImpl(uima::internal::CASDefinition & casDef) {
+uima::internal::CASImpl * getCASImpl(uima::internal::CASDefinition & casDef) {
   ErrorInfo errorInfo;
-  return * (uima::internal::CASImpl*) Framework::createCAS(casDef, errorInfo);
+  return (uima::internal::CASImpl*) Framework::createCAS(casDef, errorInfo);
 }
 
 
@@ -907,7 +907,8 @@
   LOG("Lemma number: " << LEMMA_NUM);
 
 //      uima::internal::TCASImpl tcasimpl(ttdef, 5000, 5000, 5000);
-  uima::internal::CASImpl & tcasimpl = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & tcasimpl = *pCas;
 
   uima::lowlevel::FSHeap & heap = tcasimpl.getHeap();
   uima::lowlevel::IndexRepository & ixStore = tcasimpl.getIndexRepository();
@@ -1087,7 +1088,7 @@
     it->moveToNext();
     ++i;
   }
-
+  delete pCas;
   LOG("testLowlevelIndex finished");
 
 }
@@ -1109,13 +1110,14 @@
   ttdef.commit();
 
 //      uima::internal::TCASImpl tcas(ttdef, 300, 300, 300);
-  uima::internal::CASImpl & tcas = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & tcas = *pCas;
 
   uima::lowlevel::FSHeap& heap = tcas.getHeap();
 
   lowlevel::TyFS fs = heap.createFS(t);
   UnicodeStringRef uref = heap.getStringValue(fs, f);
-
+  delete pCas;
   ASSERT_OR_THROWEXCEPTION( uref.getBuffer() == NULL );
   LOG("testEmptyStrings() finished");
 }
@@ -1141,16 +1143,18 @@
 
 //     ErrorInfo errorInfo;
 //     uima::internal::CASImpl & tcas = *(uima::internal::CASImpl*) Framework::createCAS(ttdef, errorInfo);
-  uima::internal::CASImpl & tcas = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & tcas = *pCas;
 
   lowlevel::FSHeap& heap = tcas.getHeap();
 
   lowlevel::TyFS fs = heap.createFS(t);
   float x = 0.4237f;
   heap.setFloatValue(fs, f, x);
-
+  
   float y = heap.getFloatValue(fs, f);
   ASSERT_OR_THROWEXCEPTION(x == y);
+  delete pCas;
   LOG("testFloatFeatures finished");
 }
 
@@ -1180,7 +1184,8 @@
   ttdef.commit();
 
 //      uima::internal::TCASImpl tcas(ttdef, 400, 400, 400);
-  uima::internal::CASImpl & tcas = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & tcas = *pCas;
 
 //#ifndef NDEBUG
 //   ts.print(cout);
@@ -1215,7 +1220,7 @@
   ASSERT_OR_THROWEXCEPTION( heap.getFSValue(fs_t2, f2) == fs_t4 );
   ASSERT_OR_THROWEXCEPTION( heap.getFSValue(fs_t3, f3) == fs_t5 );
 
-
+  delete pCas;
   LOG("testNestedStructures finished");
 }
 
@@ -1343,7 +1348,8 @@
 //   tcas.createPredefinedTTIndexes();
 
 //      uima::internal::TCASImpl tcas(ttdef, 50000, 50000, 50000);
-  uima::internal::CASImpl & tcas = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & tcas = *pCas;
 
 
   // check invalid fs
@@ -1479,7 +1485,7 @@
     LOG("Exception thrown correctly: " << exc.asString());
     bExceptionThrown = true;
   }
-
+  delete pCas;
   LOG("testOOExceptions() finished");
 }
 
@@ -1492,7 +1498,7 @@
 
   TTDefinition ttdef;
   ttdef.init();
-
+  
 
 
   TypeSystem const & typeSystem  = ttdef.getTypeSystem();
@@ -1522,7 +1528,8 @@
 
   ttdef.commit();
 //      uima::internal::TCASImpl tcas(ttdef, 4000, 4000, 4000);
-  uima::internal::CASImpl & tcas = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & tcas = *pCas;
 
   uima::FSIndexRepository & indexRep = tcas.getIndexRepository();
 
@@ -2785,7 +2792,7 @@
   ASSERT_OR_THROWEXCEPTION( beginPosFeature5.isValid() );
   ASSERT_OR_THROWEXCEPTION( beginPosFeature5 == beginPosFeature );
   */
-
+ 
   LOG("testFullyQualifiedFeatureNames() finished");
 }
 /************************************************************************************/
@@ -2824,7 +2831,8 @@
   ttdef.commit();
 
 //      uima::internal::TCASImpl cas(ttdef, 1000, 1000, 1000);
-  uima::internal::CASImpl & cas = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & cas = *pCas;
   TypeSystem const & typeSys = cas.getTypeSystem();
 
   TypeNameSpace n1(typeSys, "n1");
@@ -2878,7 +2886,7 @@
   ASSERT_OR_THROWEXCEPTION( ! noConflict );
   ASSERT_OR_THROWEXCEPTION( ! t.isValid() );
 
-
+  delete pCas;
   LOG("testTypeNameSpaces() finished");
 }
 /************************************************************************************/
@@ -3016,7 +3024,8 @@
   ttdef.commit();
 
 //      uima::internal::TCASImpl tcas(ttdef, 5000, 5000, 5000);
-  uima::internal::CASImpl & tcas = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & tcas = *pCas;
   uima::TypeSystem const & crTypeSystem = tcas.getTypeSystem();
 
   uima::Type top = crTypeSystem.getTopType();
@@ -3054,7 +3063,7 @@
 #endif
 
   XMLPlatformUtils::Terminate();
-
+  delete pCas;
   LOG("testXMLTypeSystemReader() finished");
 }
 
@@ -3088,7 +3097,8 @@
   ASSERT_OR_THROWEXCEPTION( ts.getTypeByName("t2") == t2 );
 
 //      uima::internal::TCASImpl tcas(ttdef, 5000, 5000, 5000);
-  uima::internal::CASImpl & tcas = getCASImpl(ttdef);
+   uima::internal::CASImpl * pCas = getCASImpl(ttdef);
+  uima::internal::CASImpl & tcas = *pCas;
   // lowlevel API
   lowlevel::FSHeap & heap = tcas.getHeap();
 
@@ -3121,7 +3131,7 @@
   }
   ASSERT_OR_THROWEXCEPTION( bExcCaught );
 
-
+  delete pCas;
   LOG("testStringSubypes() finished");
 }
 
@@ -3210,6 +3220,11 @@
 int main() {
   LOG("*********************************");
   LOG("   UIMA5 regression test");
+  LOG(" Please note that when running in debug");
+  LOG(" mode the test routine testOOFilterBuilder()");
+  LOG(" will report memory leaks because the TTDefinition");
+  LOG(" does not properly clean up memory allocations.");
+
   LOG("*********************************");
   LOG("Go...");
 
@@ -3227,16 +3242,16 @@
     testNestedStructures();
 
 
-
+  
     testStringSubypes();
     testFilters();
     testPermanentStructures();
     testIteratorSetToPosition();
-
+   
     testOOIndex();
     testOOExceptions();
 
-    testOOFilterBuilder();
+    testOOFilterBuilder();  //TTDefinition leak
     testOOArrayFS();
     testOOStringArrayFS();
     testClone();
@@ -3254,7 +3269,7 @@
     testTypeNameSpaces();
 
     testXMLTypeSystemReader();
-
+    
   } catch (Exception & exc) {
     LOG("UIMA exception: " << endl << exc.asString());
     bSuccess = false;
@@ -3290,4 +3305,5 @@
   LOG("*********************************");
   return 0;
 }
+
 

Modified: incubator/uima/uimacpp/trunk/src/test/src/test_casserializer.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_casserializer.cpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_casserializer.cpp (original)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_casserializer.cpp Fri Jun  8 07:45:20 2007
@@ -353,7 +353,7 @@
   delete tcas;
   delete newTCAS;
   delete pEngine;
-
+  delete blob;
 }
 
 /* ----------------------------------------------------------------------- */
@@ -366,7 +366,9 @@
   /* create console */
   util::ConsoleUI * pConsole = new util::ConsoleUI(argc, argv, MAIN_TITLE, "\n");
   assert(EXISTS(pConsole));
-
+  #if !defined(NDEBUG) && defined(_MSC_VER)
+   //int iRetVal = _CrtSetBreakAlloc(124613);
+  #endif
   /* create a UIMA resource */
   try {
     ResourceManager::createInstance(MAIN_TITLE);
@@ -381,11 +383,12 @@
     pConsole->error(rclException.what());
     return 1;
   }
-
+  delete pConsole;
   return(0);
 
 }
 
 /* <EOF> */
+
 
 

Modified: incubator/uima/uimacpp/trunk/src/test/src/test_engine.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_engine.cpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_engine.cpp (original)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_engine.cpp Fri Jun  8 07:45:20 2007
@@ -428,7 +428,8 @@
     pEngine->getAnnotatorContext().releaseCAS(seg);
   }
   failIfNotTrue(num==3);
-
+  delete pEngine;
+  delete cas;
   rclConsole.info("testCasMultiplier finished." );
 }
 
@@ -521,4 +522,5 @@
 }
 
 /* <EOF> */
+
 

Modified: incubator/uima/uimacpp/trunk/src/test/src/test_iterators.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/test/src/test_iterators.cpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/test/src/test_iterators.cpp (original)
+++ incubator/uima/uimacpp/trunk/src/test/src/test_iterators.cpp Fri Jun  8 07:45:20 2007
@@ -605,6 +605,8 @@
   checkSubIterators(uima::TT::TYPE_NAME_SENTENCE_ANNOTATION, uima::TT::TYPE_NAME_TOKEN_ANNOTATION, enUnambiguous, *tcas, pConsole );
   checkSubIterators(uima::CAS::TYPE_NAME_ANNOTATION, uima::TT::TYPE_NAME_TOKEN_ANNOTATION, enUnambiguous, *tcas, pConsole );
   checkSubIterators(uima::TT::TYPE_NAME_LEXICAL_ANNOTATION, uima::TT::TYPE_NAME_LEXICAL_ANNOTATION, enUnambiguous, *tcas, pConsole );
+  delete tcas;
+  delete pEngine;
   pConsole->info("Sub Iterators test finished.");
 }
 /**
@@ -663,6 +665,8 @@
   /* checkIterators twice - true/false */
   checkIterators(true, pConsole, &(uima::internal::CASImpl::promoteCAS(*tcas)));
   checkIterators(false, pConsole,  &(uima::internal::CASImpl::promoteCAS(*tcas)));
+  delete tcas;
+  delete pEngine;
   pConsole->info("Iterators test finished");
 }
 
@@ -718,6 +722,8 @@
     ASSERT_OR_THROWEXCEPTION( checkIndex(an1, ix) );
     ASSERT_OR_THROWEXCEPTION( checkIndex(an2, ix) );
   }
+  delete tcas;
+  delete pEngine;
   pConsole->info("Caching test finished");
   return;
 }
@@ -770,7 +776,8 @@
     pConsole->error(rclException.what());
     return 1;
   }
-
+  delete pConsole;
   return(0);
 }
+
 

Modified: incubator/uima/uimacpp/trunk/src/utils/runAECpp.cpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/utils/runAECpp.cpp?view=diff&rev=545527&r1=545526&r2=545527
==============================================================================
--- incubator/uima/uimacpp/trunk/src/utils/runAECpp.cpp (original)
+++ incubator/uima/uimacpp/trunk/src/utils/runAECpp.cpp Fri Jun  8 07:45:20 2007
@@ -133,6 +133,13 @@
     /* Create/link up to a UIMACPP resource manager instance (singleton) */
     (void) ResourceManager::createInstance("runAECpp");
 
+    /* check if input file / directory exists */
+    uima::util::Filename infn(in.c_str());
+    if (!infn.isExistent() ) {
+      cout << "runAECpp: ERROR: input file / directory does not exist. " << endl;
+      return -1;
+    }
+
     if (loglevel >= 0) {
       ResourceManager::getInstance().setLoggingLevel((LogStream::EnEntryType)loglevel);
     }
@@ -374,4 +381,5 @@
 }
 
 /* <EOF> */
+