2006-11-08 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 9 Nov 2006 02:11:40 +0000 (02:11 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 9 Nov 2006 02:11:40 +0000 (02:11 -0000)
* XmlSchemaImporter.cs : ImportTypeMapping() raises exception when
  the argument name is not bound to any elements.

* XmlSchemaImporterTests.cs : added ImportTypeMapping() test for
  nonexistent name.

svn path=/trunk/mcs/; revision=67560

mcs/class/System.XML/System.Xml.Serialization/ChangeLog
mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
mcs/class/System.XML/Test/System.Xml.Serialization/ChangeLog
mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaImporterTests.cs

index deb8215defde070969add0e07721d9f8ddf88327..14521dc451406718ce845f76d01cbdc071c439f6 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-08  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XmlSchemaImporter.cs : ImportTypeMapping() raises exception when
+         the argument name is not bound to any elements.
+
 2006-11-07  Atsushi Enomoto  <atsushi@ximian.com>
 
        * XmlCustomFormatter.cs : consider null base64 byte array value.
index 5c867c6a82763043be0777fc16869f05307f4e49..f565e5dbe84765cefdaa1f09022292480339a5a4 100644 (file)
@@ -446,7 +446,8 @@ namespace System.Xml.Serialization
                        XmlSchemaType stype;
 
                        XmlSchemaElement elem = (XmlSchemaElement) schemas.Find (name, typeof (XmlSchemaElement));
-                       if (!LocateElement (elem, out qname, out stype)) return null;
+                       if (!LocateElement (elem, out qname, out stype))
+                               throw new InvalidOperationException (String.Format ("'{0}' is missing.", name));
                        
                        if (stype == null) {
                                // Importing a primitive type
index 78dd6e972a29bf15f30adb28b0202e7da4a7c21b..d44edaf4dbee5539be22ff01a61583253463e74c 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-08  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XmlSchemaImporterTests.cs : added ImportTypeMapping() test for
+         nonexistent name.
+
 2006-11-02  Atsushi Enomoto  <atsushi@ximian.com>
 
        * CodeIdentifiersTests.cs : new test.
index 99537662f1acfb5f702838aa16badf548155a5cf..ecf786d020261551f9c4b5efd1c1db4ea9cadfb3 100644 (file)
@@ -993,5 +993,15 @@ namespace MonoTests.System.XmlSerialization
 
                        return qnames;
                }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void ImportTypeMappingNonExistent ()
+               {
+                       XmlSchemas xss = new XmlSchemas ();
+                       xss.Add (new XmlSchema ());
+                       XmlSchemaImporter imp = new XmlSchemaImporter (xss);
+                       imp.ImportTypeMapping (new XmlQualifiedName ("foo"));
+               }
        }
 }