2009-06-05 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / class / System.Security / System.Security.Cryptography.Xml / XmlDecryptionTransform.cs
index 27ac0f527de2147272a4c7deb959ecd45aa2d3df..29b6d0970a0a70688f20f489ae3103824294899d 100644 (file)
@@ -44,7 +44,6 @@ namespace System.Security.Cryptography.Xml {
                Type[] outputTypes;
                object inputObj;
                ArrayList exceptUris;
-               object lockObject;
 
                const string NamespaceUri = "http://www.w3.org/2002/07/decrypt#";
 
@@ -57,7 +56,6 @@ namespace System.Security.Cryptography.Xml {
                        Algorithm = XmlSignature.AlgorithmNamespaces.XmlDecryptionTransform;
                        encryptedXml = new EncryptedXml ();
                        exceptUris = new ArrayList ();
-                       lockObject = new object ();
                }
        
                #endregion // Constructors
@@ -71,22 +69,18 @@ namespace System.Security.Cryptography.Xml {
 
                public override Type[] InputTypes {
                        get { 
-                               if (inputTypes == null) {
-                                       lock (lockObject) {
-                                               inputTypes = new Type [2] {typeof (System.IO.Stream), typeof (System.Xml.XmlDocument)}; 
-                                       }
-                               }
+                               if (inputTypes == null)
+                                       inputTypes = new Type [2] {typeof (System.IO.Stream), typeof (System.Xml.XmlDocument)}; 
+
                                return inputTypes;
                        }
                }
 
                public override Type[] OutputTypes {
                        get { 
-                               if (outputTypes == null) {
-                                       lock (lockObject) {
-                                               outputTypes = new Type [1] {typeof (System.Xml.XmlDocument)};
-                                       }
-                               }
+                               if (outputTypes == null)
+                                       outputTypes = new Type [1] {typeof (System.Xml.XmlDocument)};
+
                                return outputTypes;
                        }
                }
@@ -159,7 +153,7 @@ namespace System.Security.Cryptography.Xml {
 
                public override object GetOutput (Type type)
                {       
-                       if (type == Type.GetType ("Stream"))
+                       if (type == typeof (Stream))
                                return GetOutput ();
                        throw new ArgumentException ("type");
                }
@@ -167,6 +161,8 @@ namespace System.Security.Cryptography.Xml {
                [MonoTODO ("verify")]
                protected virtual bool IsTargetElement (XmlElement inputElement, string idValue)
                {
+                       if ((inputElement == null) || (idValue == null))
+                               return false;
                        return (inputElement.Attributes ["id"].Value == idValue);
                }