[mapguide-commits] r9364 - in branches/3.1/MgDev: . Common/MapGuideCommon/Resources Common/PlatformBase/Services Server/src/UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Mar 6 06:55:17 PST 2018


Author: jng
Date: 2018-03-06 06:55:17 -0800 (Tue, 06 Mar 2018)
New Revision: 9364

Modified:
   branches/3.1/MgDev/
   branches/3.1/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res
   branches/3.1/MgDev/Common/PlatformBase/Services/ResourceIdentifier.cpp
   branches/3.1/MgDev/Server/src/UnitTesting/TestMisc.cpp
   branches/3.1/MgDev/Server/src/UnitTesting/TestMisc.h
Log:
Merged revision(s) 9363 from trunk/MgDev:
Include bad identifier in exception message if "new MgResourceIdentifier()" throws.

Fixes #2582
........


Index: branches/3.1/MgDev
===================================================================
--- branches/3.1/MgDev	2018-03-06 14:52:05 UTC (rev 9363)
+++ branches/3.1/MgDev	2018-03-06 14:55:17 UTC (rev 9364)

Property changes on: branches/3.1/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
## -15,4 +15,4 ##
 /sandbox/jng/tiling:8174-8208
 /sandbox/jng/v30:8212-8227
 /sandbox/rfc94:5099-5163
-/trunk/MgDev:8955-8956,8969,8980-8981,8986,8996,9000,9004-9006,9010,9018-9021,9034,9038,9042,9094,9106-9107,9147,9339-9343,9353,9360
\ No newline at end of property
+/trunk/MgDev:8955-8956,8969,8980-8981,8986,8996,9000,9004-9006,9010,9018-9021,9034,9038,9042,9094,9106-9107,9147,9339-9343,9353,9360,9363
\ No newline at end of property
Modified: branches/3.1/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res
===================================================================
--- branches/3.1/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res	2018-03-06 14:52:05 UTC (rev 9363)
+++ branches/3.1/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res	2018-03-06 14:55:17 UTC (rev 9364)
@@ -160,6 +160,7 @@
 [ErrorDescription]
 MgArgumentsMismatch                                   = The arguments needed do not match the arguments provided.
 MgArgumentOutOfRange                                  = Argument out of range [%1, %2]: %3
+MgBadResourceIdentifer                                = Bad Resource Identifier: %1
 MgClassWOIdentity                                     = A class definition has no identity property.
 MgCannotResolveFeatureSourceFromWfsTypeName           = Could not resolve the Feature Source from the given WFS Type Name: %1
 MgCollectionEmpty                                     = The collection cannot be empty.

Modified: branches/3.1/MgDev/Common/PlatformBase/Services/ResourceIdentifier.cpp
===================================================================
--- branches/3.1/MgDev/Common/PlatformBase/Services/ResourceIdentifier.cpp	2018-03-06 14:52:05 UTC (rev 9363)
+++ branches/3.1/MgDev/Common/PlatformBase/Services/ResourceIdentifier.cpp	2018-03-06 14:55:17 UTC (rev 9364)
@@ -451,8 +451,10 @@
     }
     else
     {
+        MgStringCollection args;
+        args.Add(resource);
         throw new MgInvalidRepositoryTypeException(
-            L"MgResourceIdentifier.ParseIdentifier", __LINE__,  __WFILE__, NULL, L"", NULL);
+            L"MgResourceIdentifier.ParseIdentifier", __LINE__,  __WFILE__, NULL, L"MgBadResourceIdentifer", &args);
     }
 
     Validate();

Modified: branches/3.1/MgDev/Server/src/UnitTesting/TestMisc.cpp
===================================================================
--- branches/3.1/MgDev/Server/src/UnitTesting/TestMisc.cpp	2018-03-06 14:52:05 UTC (rev 9363)
+++ branches/3.1/MgDev/Server/src/UnitTesting/TestMisc.cpp	2018-03-06 14:55:17 UTC (rev 9364)
@@ -594,4 +594,23 @@
     {
         throw;
     }
+}
+
+void TestMisc::TestCase_BadResourceIdentifier()
+{
+    try
+    {
+        Ptr<MgResourceIdentifier> resId = new MgResourceIdentifier(L"I'm a baaaaad id");
+        CPPUNIT_FAIL("This should've thrown");
+    }
+    catch (MgException* e)
+    {
+        STRING message = e->GetDetails(TEST_LOCALE);
+        SAFE_RELEASE(e);
+        CPPUNIT_ASSERT(message.find(L"I'm a baaaaad id") != STRING::npos);
+    }
+    catch (...)
+    {
+        throw;
+    }
 }
\ No newline at end of file

Modified: branches/3.1/MgDev/Server/src/UnitTesting/TestMisc.h
===================================================================
--- branches/3.1/MgDev/Server/src/UnitTesting/TestMisc.h	2018-03-06 14:52:05 UTC (rev 9363)
+++ branches/3.1/MgDev/Server/src/UnitTesting/TestMisc.h	2018-03-06 14:55:17 UTC (rev 9364)
@@ -30,6 +30,7 @@
     CPPUNIT_TEST(TestCase_833);
     CPPUNIT_TEST(TestCase_1304);
     CPPUNIT_TEST(TestCase_MapLayerCollections);
+    CPPUNIT_TEST(TestCase_BadResourceIdentifier);
 
     CPPUNIT_TEST(TestEnd); // This must be the very last unit test
     CPPUNIT_TEST_SUITE_END();
@@ -48,6 +49,7 @@
     void TestCase_833();
     void TestCase_1304();
     void TestCase_MapLayerCollections();
+    void TestCase_BadResourceIdentifier();
 
 private:
     Ptr<MgSiteConnection> m_siteConnection;



More information about the mapguide-commits mailing list