2006-09-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System / System.Text.RegularExpressions / Match.cs
index 09c472b61eb9b9149ad44f46537897f36180464f..768fca2265e70b88da443bb471f3e686447580f6 100644 (file)
@@ -5,7 +5,7 @@
 //
 // author:     Dan Lewis (dlewis@gmx.co.uk)
 //             (c) 2002
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -27,8 +27,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
-
 namespace System.Text.RegularExpressions {
 
        [Serializable]
@@ -36,9 +34,12 @@ namespace System.Text.RegularExpressions {
                public static Match Empty {
                        get { return empty; }
                }
-               
+
+               [MonoTODO ("not thread-safe")]
                public static Match Synchronized (Match inner)
                {
+                       if (inner == null)
+                               throw new ArgumentNullException ("inner");
                        return inner;   // FIXME need to sync on machine access
                }
                
@@ -63,12 +64,17 @@ namespace System.Text.RegularExpressions {
 
                public virtual string Result (string replacement)
                {
+                       if (replacement == null)
+                               throw new ArgumentNullException ("replacement");
+                       if (replacement.Length == 0)
+                               throw new NotSupportedException ();
+
                        return ReplacementEvaluator.Evaluate (replacement, this);
                }
 
                // internal
 
-               private Match () : base ()
+               private Match ()
                {
                        this.regex = null;
                        this.machine = null;