[mapguide-commits] r7448 - branches/2.5/MgDev/Server/src/Services/Feature

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Apr 5 05:46:53 PDT 2013


Author: jng
Date: 2013-04-05 05:46:53 -0700 (Fri, 05 Apr 2013)
New Revision: 7448

Modified:
   branches/2.5/MgDev/Server/src/Services/Feature/OpUpdateFeatures.cpp
Log:
#2218: Fix UpdateFeatures() hopefully once and for all. In non-transactional mode, we don't throw an exception (as this violates the API contract from the web tier's perspective). What we do instead is log the exception immediately (stack trace will be included in the serialized exception due to #2251 being fixed), and then proceed to write out the original MgPropertyCollection as the response.

Modified: branches/2.5/MgDev/Server/src/Services/Feature/OpUpdateFeatures.cpp
===================================================================
--- branches/2.5/MgDev/Server/src/Services/Feature/OpUpdateFeatures.cpp	2013-04-05 12:43:02 UTC (rev 7447)
+++ branches/2.5/MgDev/Server/src/Services/Feature/OpUpdateFeatures.cpp	2013-04-05 12:46:53 UTC (rev 7448)
@@ -55,6 +55,7 @@
     ACE_DEBUG((LM_DEBUG, ACE_TEXT("  (%t) MgOpUpdateFeatures::Execute()\n")));
 
     STRING partialFailureMsg;
+    Ptr<MgPropertyCollection> rowsAffected;
     MG_LOG_OPERATION_MESSAGE(L"UpdateFeatures");
 
     MG_FEATURE_SERVICE_TRY()
@@ -89,7 +90,7 @@
         Validate();
 
         // Execute the operation
-        Ptr<MgPropertyCollection> rowsAffected = m_service->UpdateFeatures(resource, commands, useTransaction);
+        rowsAffected = m_service->UpdateFeatures(resource, commands, useTransaction);
 
         // #649: Exceptions are only thrown in transactional cases (which will never reach here). For non-transactional cases, 
         // we check for any MgStringProperty instances. These are "serialized" FDO exception messages indicating failure for that 
@@ -138,13 +139,18 @@
     {
         // Failed operation
         MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
-        // Only thrown exceptions are logged, so for this partial failure to be logged into Error.log it needs to be
-        // wrapped in an MgException to be thrown at the end of this method
+        // Only thrown exceptions are logged, so for this partial failure to be logged into Error.log
+        // we have to log it here
         if (mgException == NULL && !partialFailureMsg.empty())
         {
-            MgStringCollection args;
-            args.Add(partialFailureMsg);
-            mgException = new MgFeatureServiceException(L"MgOpUpdateFeatures.Execute", __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &args);
+            //NOTE: Serialized MgFdoException already has the stack trace, so stub an empty string to
+            //satisfy the logging macro
+            STRING sTrace = L"";
+            MG_LOG_EXCEPTION_ENTRY(partialFailureMsg, sTrace);
+
+            //DO NOT THROW A NEW EXCEPTION! We must respect the original contract of the API as perceived by the
+            //calling web tier code. That is: Write out the original MgPropertyCollection
+            EndExecution(rowsAffected);
         }
     }
 



More information about the mapguide-commits mailing list