Merge pull request #2024 from BogdanovKirill/webrequesttest
[mono.git] / mcs / class / System.Security / System.Security.Cryptography.Xml / XmlDecryptionTransform.cs
index 27ac0f527de2147272a4c7deb959ecd45aa2d3df..154061b1949adb39a9440c3b1b8277e33d52fa48 100644 (file)
@@ -27,7 +27,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 
 using System.Collections;
 using System.IO;
@@ -44,7 +43,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 +55,6 @@ namespace System.Security.Cryptography.Xml {
                        Algorithm = XmlSignature.AlgorithmNamespaces.XmlDecryptionTransform;
                        encryptedXml = new EncryptedXml ();
                        exceptUris = new ArrayList ();
-                       lockObject = new object ();
                }
        
                #endregion // Constructors
@@ -71,22 +68,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 +152,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 +160,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);
                }
 
@@ -197,4 +192,3 @@ namespace System.Security.Cryptography.Xml {
        }
 }
 
-#endif