diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2010-01-26 21:33:30 +0300 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2010-01-26 21:33:30 +0300 |
commit | 70ffc535d0d72eaf0811a19b2e7faeb99330123d (patch) | |
tree | d667ceb872b1b3d7b29cd219724f34fd13268c32 | |
parent | 875517d8cfcdad5d92125fc98ddbc668fb27cf58 (diff) |
2010-01-26 Sebastien Pouliot <sebastien@ximian.com>
* DataContractJsonSerializer_2_1.cs: Don't hide [Field|Method]
AccessException inside a SerializationException but in a
SecurityException.
[Backport r150219]
svn path=/branches/mono-2-6/mcs/; revision=150220
2 files changed, 16 insertions, 0 deletions
diff --git a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog index e851f9d5842..e157a04f853 100644 --- a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog +++ b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog @@ -1,3 +1,10 @@ +2010-01-26 Sebastien Pouliot <sebastien@ximian.com> + + * DataContractJsonSerializer_2_1.cs: Don't hide [Field|Method] + AccessException inside a SerializationException but in a + SecurityException. + [Backport r150219] + 2010-01-25 Sebastien Pouliot <sebastien@ximian.com> * DataContractJsonSerializer_2_1.cs: New. Simpler version for diff --git a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer_2_1.cs b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer_2_1.cs index 1576a5ebb54..794ab9ce68d 100644 --- a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer_2_1.cs +++ b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer_2_1.cs @@ -31,6 +31,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; +using System.Security; using System.Xml; namespace System.Runtime.Serialization.Json { @@ -80,6 +81,10 @@ namespace System.Runtime.Serialization.Json { "root", r.LocalName, r.NamespaceURI)); } return new JsonSerializationReader (this, r, type, true).ReadRoot (); + } catch (FieldAccessException fae) { + throw new SecurityException ("Deserialization has failed", fae); + } catch (MethodAccessException mae) { + throw new SecurityException ("Deserialization has failed", mae); } catch (SerializationException) { throw; } catch (Exception ex) { @@ -94,6 +99,10 @@ namespace System.Runtime.Serialization.Json { writer.WriteStartElement ("root"); new JsonSerializationWriter (this, writer, type, false).WriteObjectContent (graph, true, false); writer.WriteEndElement (); + } catch (FieldAccessException fae) { + throw new SecurityException ("Serialization has failed", fae); + } catch (MethodAccessException mae) { + throw new SecurityException ("Serialization has failed", mae); } catch (NotImplementedException) { throw; } catch (InvalidDataContractException) { |