diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2009-05-19 10:25:43 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2009-05-19 10:25:43 +0400 |
commit | 1716177eb5b29e530479694137613988d01ef615 (patch) | |
tree | e50d5cb0a66c7fc124ffb504ffe8efa37db177c6 /mcs/class/System.XML/System.Xml | |
parent | 7c75a2608c9356ecca60df97a51d9fb729518883 (diff) |
2009-05-19 Atsushi Enomoto <atsushi@ximian.com>
* XmlConvert.cs : no reason not to report invalid input string for
ToGuid().
svn path=/trunk/mcs/; revision=134369
Diffstat (limited to 'mcs/class/System.XML/System.Xml')
-rw-r--r-- | mcs/class/System.XML/System.Xml/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlConvert.cs | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 2c3c9c5bac5..b59c51f1f2b 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,8 @@ +2009-05-19 Atsushi Enomoto <atsushi@ximian.com> + + * XmlConvert.cs : no reason not to report invalid input string for + ToGuid(). + 2009-04-28 Sebastien Pouliot <sebastien@ximian.com> * XmlTextReader.cs (InitializeContext): Under NET_2_1 do not give diff --git a/mcs/class/System.XML/System.Xml/XmlConvert.cs b/mcs/class/System.XML/System.Xml/XmlConvert.cs index 435196044fa..5847a22aced 100644 --- a/mcs/class/System.XML/System.Xml/XmlConvert.cs +++ b/mcs/class/System.XML/System.Xml/XmlConvert.cs @@ -399,9 +399,13 @@ namespace System.Xml { return Double.Parse (s, floatStyle, CultureInfo.InvariantCulture); } - public static Guid ToGuid(string s) + public static Guid ToGuid (string s) { - return new Guid(s); + try { + return new Guid(s); + } catch (FormatException ex) { + throw new FormatException (String.Format ("Invalid Guid input '{0}'", ex.InnerException)); + } } public static short ToInt16(string s) |