[mapguide-commits] r5865 - in
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI: . Properties Resource
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu May 26 08:53:50 EDT 2011
Author: jng
Date: 2011-05-26 05:53:49 -0700 (Thu, 26 May 2011)
New Revision: 5865
Modified:
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/ResourceContentVersionChecker.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/XmlValidator.cs
Log:
#1702: Fix NRE on validation of XML content via generic editor.
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs 2011-05-26 06:28:07 UTC (rev 5864)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs 2011-05-26 12:53:49 UTC (rev 5865)
@@ -386,6 +386,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to XML content does not match any known resource.
+ /// </summary>
+ internal static string ERR_NOT_RESOURCE_CONTENT_XML {
+ get {
+ return ResourceManager.GetString("ERR_NOT_RESOURCE_CONTENT_XML", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to No connection attached to this resource.
/// </summary>
internal static string ERR_RESOURCE_NOT_ATTACHED {
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx 2011-05-26 06:28:07 UTC (rev 5864)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx 2011-05-26 12:53:49 UTC (rev 5865)
@@ -506,4 +506,7 @@
<data name="MDF_LayerWithNonExistentGroup" xml:space="preserve">
<value>Layer ({0}) belongs to a non-existent Layer Group ({1})</value>
</data>
+ <data name="ERR_NOT_RESOURCE_CONTENT_XML" xml:space="preserve">
+ <value>XML content does not match any known resource</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/ResourceContentVersionChecker.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/ResourceContentVersionChecker.cs 2011-05-26 06:28:07 UTC (rev 5864)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/ResourceContentVersionChecker.cs 2011-05-26 12:53:49 UTC (rev 5865)
@@ -91,6 +91,9 @@
{
//Parse version number from ResourceType-x.y.z.xsd
string xsd = xr.GetAttribute("xsi:noNamespaceSchemaLocation");
+ if (xsd == null)
+ return null;
+
int start = (xsd.LastIndexOf("-"));
int end = xsd.IndexOf(".xsd") - 1;
version = xsd.Substring(start + 1, xsd.Length - end);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs 2011-05-26 06:28:07 UTC (rev 5864)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs 2011-05-26 12:53:49 UTC (rev 5865)
@@ -275,6 +275,9 @@
{
var checker = new ResourceContentVersionChecker(xml);
var rd = checker.GetVersion();
+ if (rd != null)
+ throw new SerializationException(Properties.Resources.ERR_NOT_RESOURCE_CONTENT_XML);
+
if (!_serializers.ContainsKey(rd))
throw new SerializationException(Properties.Resources.ERR_NO_SERIALIZER + rd.ToString());
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/XmlValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/XmlValidator.cs 2011-05-26 06:28:07 UTC (rev 5864)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/XmlValidator.cs 2011-05-26 12:53:49 UTC (rev 5865)
@@ -31,6 +31,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using OSGeo.MapGuide.MaestroAPI.Resource;
+ using OSGeo.MapGuide.MaestroAPI.Exceptions;
///<summary>
/// Class that makes XSD validation
@@ -135,7 +136,10 @@
}
catch (Exception ex)
{
- err.Add(ex.Message);
+ if (!(ex is SerializationException))
+ err.Add(ex.Message);
+ else
+ res = null;
}
if (res != null)
More information about the mapguide-commits
mailing list