2005-01-11 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Tue, 11 Jan 2005 20:01:35 +0000 (20:01 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Tue, 11 Jan 2005 20:01:35 +0000 (20:01 -0000)
* PermissionSetAttribute.cs: Throw proper exception if XML cannot be
decoded. Actually load (not just creates) the XML permissions.

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

mcs/class/corlib/System.Security.Permissions/ChangeLog
mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs

index 3e08cc1f39bb6fa3ba28b715f282b5b98f2acda9..3230b8504db1e9b6868e501edd229357f234d1a0 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-11  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * PermissionSetAttribute.cs: Throw proper exception if XML cannot be
+       decoded. Actually load (not just creates) the XML permissions.
+
 2005-01-08  Sebastien Pouliot  <sebastien@ximian.com>
 
        * PermissionSetAttribute.cs: Implemented Hex property (2.0) now that
index d78c9104c443a5a04187985391d5de29c57960cf..cf3856d0f76d26272bf89e87238a55e9d6129cb4 100644 (file)
@@ -93,7 +93,12 @@ namespace System.Security.Permissions {
                private PermissionSet CreateFromXml (string xml) 
                {
                        SecurityParser sp = new SecurityParser ();
-                       sp.LoadXml (xml);
+                       try {
+                               sp.LoadXml (xml);
+                       }
+                       catch (Mono.Xml.MiniParser.XMLError xe) {
+                               throw new XmlSyntaxException (xe.Line, xe.ToString ());
+                       }
                        SecurityElement se = sp.ToXml ();
 
                        string className = se.Attribute ("class");
@@ -106,10 +111,12 @@ namespace System.Security.Permissions {
 
                        if (className.EndsWith ("NamedPermissionSet")) {
                                NamedPermissionSet nps = new NamedPermissionSet (se.Attribute ("Name"), state);
+                               nps.FromXml (se);
                                return (PermissionSet) nps;
                        }
                        else if (className.EndsWith ("PermissionSet")) {
                                PermissionSet ps = new PermissionSet (state);
+                               ps.FromXml (se);
                                return ps;
                        }
                        return null;