[mapguide-commits] r6710 - in branches/2.4/MgDev: Common/Foundation/Data Common/Foundation/System Common/MapGuideCommon/Resources Common/PlatformBase/Services Server/src/Services/Feature Server/src/UnitTesting
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu May 31 00:54:06 PDT 2012
Author: jng
Date: 2012-05-31 00:54:05 -0700 (Thu, 31 May 2012)
New Revision: 6710
Modified:
branches/2.4/MgDev/Common/Foundation/Data/NamedCollection.cpp
branches/2.4/MgDev/Common/Foundation/System/Util.h
branches/2.4/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res
branches/2.4/MgDev/Common/PlatformBase/Services/FeatureReader.cpp
branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
branches/2.4/MgDev/Server/src/UnitTesting/UnitTesting.cpp
branches/2.4/MgDev/Server/src/UnitTesting/UnitTesting.vcxproj
Log:
#2013: Improve the quality of common exception messages. Also includes a new unit test to exercise some of the common exception macros.
Modified: branches/2.4/MgDev/Common/Foundation/Data/NamedCollection.cpp
===================================================================
--- branches/2.4/MgDev/Common/Foundation/Data/NamedCollection.cpp 2012-05-30 13:06:57 UTC (rev 6709)
+++ branches/2.4/MgDev/Common/Foundation/Data/NamedCollection.cpp 2012-05-31 07:54:05 UTC (rev 6710)
@@ -111,7 +111,11 @@
{
MgNamedSerializable* item = FindItem(name);
if (!item)
- throw new MgObjectNotFoundException(L"GetItem", __LINE__, __WFILE__, NULL, L"", NULL); // EXC::Create(Exception::NLSGetMessage(NLSID(38_ITEMNOTFOUND),name));
+ {
+ MgStringCollection args;
+ args.Add(name);
+ throw new MgObjectNotFoundException(L"GetItem", __LINE__, __WFILE__, NULL, L"MgNoNameForObject", &args); // EXC::Create(Exception::NLSGetMessage(NLSID(38_ITEMNOTFOUND),name));
+ }
return item;
}
Modified: branches/2.4/MgDev/Common/Foundation/System/Util.h
===================================================================
--- branches/2.4/MgDev/Common/Foundation/System/Util.h 2012-05-30 13:06:57 UTC (rev 6709)
+++ branches/2.4/MgDev/Common/Foundation/System/Util.h 2012-05-31 07:54:05 UTC (rev 6710)
@@ -583,15 +583,19 @@
#define CHECKNULL(pointer, methodname) \
if (pointer == NULL) \
{ \
+ MgStringCollection args; \
+ args.Add(L#pointer); \
throw new MgNullReferenceException(methodname, \
- __LINE__, __WFILE__, NULL, L"", NULL); \
+ __LINE__, __WFILE__, NULL, L"MgNullPointer", &args); \
}
#define CHECKARGUMENTNULL(pointer, methodname) \
if (pointer == NULL) \
{ \
+ MgStringCollection args; \
+ args.Add(L#pointer); \
throw new MgNullArgumentException(methodname, \
- __LINE__, __WFILE__, NULL, L"", NULL); \
+ __LINE__, __WFILE__, NULL, L"MgNullArgument", &args); \
}
#define MG_CHECK_RANGE(value, min, max, methodName) \
@@ -599,8 +603,12 @@
{ \
if (NULL != methodName) \
{ \
+ MgStringCollection args; \
+ args.Add(L#min); \
+ args.Add(L#max); \
+ args.Add(L#value); \
throw new MgArgumentOutOfRangeException( \
- methodName, __LINE__, __WFILE__, NULL, L"", NULL); \
+ methodName, __LINE__, __WFILE__, NULL, L"MgArgumentOutOfRange", &args); \
} \
else if (value < min) \
{ \
Modified: branches/2.4/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res
===================================================================
--- branches/2.4/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res 2012-05-30 13:06:57 UTC (rev 6709)
+++ branches/2.4/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res 2012-05-31 07:54:05 UTC (rev 6710)
@@ -157,6 +157,7 @@
# *****************************************************************************
[ErrorDescription]
MgArgumentsMismatch = The arguments needed do not match the arguments provided.
+MgArgumentOutOfRange = Argument out of range [%1, %2]: %3
MgClassWOIdentity = A class definition has no identity property.
MgCollectionEmpty = The collection cannot be empty.
MgCoordinateSystemNotReadyException = The object is not ready for this operation.
@@ -298,6 +299,9 @@
MgMissingSrs = No coordinate system specified.
MgNameNotFound = The name was not found.
MgNoDataFromRenderer = No data from renderer.
+MgNoNameForObject = No object found for name (%1)
+MgNullArgument = Null argument: %1
+MgNullPointer = Null pointer: %1
MgPropertyValuesEmpty = The property values cannot be empty.
MgReaderIdNotFound = The reader ID was not found.
MgRepositoryAlreadyOpened = The repository is already opened by another process (e.g. If you are running the server interactively as an application from the command line, are you also running the server as a service?).
Modified: branches/2.4/MgDev/Common/PlatformBase/Services/FeatureReader.cpp
===================================================================
--- branches/2.4/MgDev/Common/PlatformBase/Services/FeatureReader.cpp 2012-05-30 13:06:57 UTC (rev 6709)
+++ branches/2.4/MgDev/Common/PlatformBase/Services/FeatureReader.cpp 2012-05-31 07:54:05 UTC (rev 6710)
@@ -75,7 +75,9 @@
}
else
{
- throw new MgObjectNotFoundException(L"MgFeatureReader.GetPropertyIndex", __LINE__, __WFILE__, NULL, L"", NULL);
+ MgStringCollection args;
+ args.Add(propertyName);
+ throw new MgObjectNotFoundException(L"MgFeatureReader.GetPropertyIndex", __LINE__, __WFILE__, NULL, L"MgNoNameForObject", &args);
return -1; // to suppress compiler warning.
}
}
Modified: branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
===================================================================
--- branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp 2012-05-30 13:06:57 UTC (rev 6709)
+++ branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp 2012-05-31 07:54:05 UTC (rev 6710)
@@ -1263,8 +1263,13 @@
if (NULL == classFound.p)
{
+ STRING qualifiedName = currSchemaName;
+ qualifiedName += L":";
+ qualifiedName += currClassName;
+ MgStringCollection args;
+ args.Add(qualifiedName);
throw new MgObjectNotFoundException(L"DescribeWfsFeatureType",
- __LINE__, __WFILE__, NULL, L"", NULL);
+ __LINE__, __WFILE__, NULL, L"MgNoNameForObject", &args);
}
else
{
Modified: branches/2.4/MgDev/Server/src/UnitTesting/UnitTesting.cpp
===================================================================
--- branches/2.4/MgDev/Server/src/UnitTesting/UnitTesting.cpp 2012-05-30 13:06:57 UTC (rev 6709)
+++ branches/2.4/MgDev/Server/src/UnitTesting/UnitTesting.cpp 2012-05-31 07:54:05 UTC (rev 6710)
@@ -53,6 +53,7 @@
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestMdfModel").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestKmlService").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestMappingService").makeTest());
+ runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestMisc").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestRenderingService").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestResourceService").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestTileService").makeTest());
@@ -82,6 +83,7 @@
ACE_OS::printf(" LogManager\n");
ACE_OS::printf(" MappingService\n");
ACE_OS::printf(" MdfModel\n");
+ ACE_OS::printf(" Misc\n");
ACE_OS::printf(" Performance\n");
ACE_OS::printf(" RenderingService\n");
ACE_OS::printf(" ResourceService\n");
@@ -132,6 +134,11 @@
ACE_DEBUG((LM_INFO, ACE_TEXT(">>>>> Running only MdfModel tests. <<<<<\n\n")));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestMdfModel").makeTest());
}
+ else if(ACE_OS::strcasecmp(MG_WCHAR_TO_TCHAR(test), ACE_LIB_TEXT("Misc")) == 0)
+ {
+ ACE_DEBUG((LM_INFO, ACE_TEXT(">>>>> Running only Miscellaneous tests. <<<<<\n\n")));
+ runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestMisc").makeTest());
+ }
else if(ACE_OS::strcasecmp(MG_WCHAR_TO_TCHAR(test), ACE_LIB_TEXT("Performance")) == 0)
{
ACE_DEBUG((LM_INFO, ACE_TEXT(">>>>> Running only Performance tests. <<<<<\n\n")));
@@ -209,6 +216,7 @@
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestMdfModel").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestKmlService").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestMappingService").makeTest());
+ runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestMisc").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestRenderingService").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestResourceService").makeTest());
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry("TestTileService").makeTest());
Modified: branches/2.4/MgDev/Server/src/UnitTesting/UnitTesting.vcxproj
===================================================================
--- branches/2.4/MgDev/Server/src/UnitTesting/UnitTesting.vcxproj 2012-05-30 13:06:57 UTC (rev 6709)
+++ branches/2.4/MgDev/Server/src/UnitTesting/UnitTesting.vcxproj 2012-05-31 07:54:05 UTC (rev 6710)
@@ -201,6 +201,7 @@
<ClInclude Include="TestLogManagerThread.h" />
<ClInclude Include="TestMappingService.h" />
<ClInclude Include="TestMdfModel.h" />
+ <ClInclude Include="TestMisc.h" />
<ClInclude Include="TestPerformance.h" />
<ClInclude Include="TestProfilingService.h" />
<ClInclude Include="TestRenderingService.h" />
@@ -223,6 +224,7 @@
<ClCompile Include="TestLogManagerThread.cpp" />
<ClCompile Include="TestMappingService.cpp" />
<ClCompile Include="TestMdfModel.cpp" />
+ <ClCompile Include="TestMisc.cpp" />
<ClCompile Include="TestPerformance.cpp" />
<ClCompile Include="TestProfilingService.cpp" />
<ClCompile Include="TestRenderingService.cpp" />
More information about the mapguide-commits
mailing list