[mapguide-commits] r1167 - trunk/MgDev/Common/Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Mar 7 12:37:01 EST 2007


Author: waltweltonlair
Date: 2007-03-07 12:37:01 -0500 (Wed, 07 Mar 2007)
New Revision: 1167

Modified:
   trunk/MgDev/Common/Stylization/SE_Include.h
Log:
Fix the symbology unit tests.  The cross-tick line style test was failing
because expression evaluation was throwing an exception.  I'm sure the
expression evaluation code will be updated at some point, but for now this
just gets things running again.


Modified: trunk/MgDev/Common/Stylization/SE_Include.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Include.h	2007-03-07 16:26:50 UTC (rev 1166)
+++ trunk/MgDev/Common/Stylization/SE_Include.h	2007-03-07 17:37:01 UTC (rev 1167)
@@ -57,8 +57,20 @@
     {
         if (expression)
         {
-            expression->Process(processor);
-            *((unsigned int*)this) = (unsigned int)processor->GetInt64Result();
+            // we need to try-catch the expression evaluation
+            try
+            {
+                expression->Process(processor);
+                *((unsigned int*)this) = (unsigned int)processor->GetInt64Result();
+            }
+            catch (FdoException* e)
+            {
+                e->Release();
+                processor->Reset();
+
+                // set a default
+                *((unsigned int*)this) = 0;
+            }
         }
         
         return *((unsigned int*)this);
@@ -82,8 +94,20 @@
     {
         if (expression)
         {
-            expression->Process(processor);
-            value = processor->GetDoubleResult();
+            // we need to try-catch the expression evaluation
+            try
+            {
+                expression->Process(processor);
+                value = processor->GetDoubleResult();
+            }
+            catch (FdoException* e)
+            {
+                e->Release();
+                processor->Reset();
+
+                // set a default
+                value = 0.0;
+            }
         }
 
         return value;
@@ -105,8 +129,20 @@
     {
         if (expression)
         {
-            expression->Process(processor);
-            value = (int)processor->GetInt64Result();
+            // we need to try-catch the expression evaluation
+            try
+            {
+                expression->Process(processor);
+                value = (int)processor->GetInt64Result();
+            }
+            catch (FdoException* e)
+            {
+                e->Release();
+                processor->Reset();
+
+                // set a default
+                value = 0;
+            }
         }
 
         return value;
@@ -128,8 +164,20 @@
     {
         if (expression)
         {
-            expression->Process(processor);
-            value = (bool)processor->GetBooleanResult();
+            // we need to try-catch the expression evaluation
+            try
+            {
+                expression->Process(processor);
+                value = (bool)processor->GetBooleanResult();
+            }
+            catch (FdoException* e)
+            {
+                e->Release();
+                processor->Reset();
+
+                // set a default
+                value = false;
+            }
         }
 
         return value;
@@ -158,9 +206,32 @@
         if (expression)
         {
             if (value)
+            {
                 delete[] value;
-            expression->Process(processor);
-            value = processor->GetStringResult();
+                value = NULL;
+            }
+
+            wchar_t* newValue = NULL;
+
+            // we need to try-catch the expression evaluation
+            try
+            {
+                expression->Process(processor);
+                newValue = processor->GetStringResult();
+            }
+            catch (FdoException* e)
+            {
+                e->Release();
+                processor->Reset();
+
+                // just return the stored expression
+                FdoString* exprValue = expression->ToString();
+                size_t len = wcslen(exprValue) + 1;
+                newValue = new wchar_t[len];
+                wcscpy(newValue, exprValue);
+            }
+
+            value = newValue;
         }
 
         return value;



More information about the mapguide-commits mailing list