Author: andrews
Date: 2006-11-29 06:41:40 -0500 (Wed, 29 Nov 2006)
New Revision: 68655

Modified:
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/MyHost.jvm.cs
Log:
store WebException.Response in WebTest.Response and swallow the exception

Modified: 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/MyHost.jvm.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/MyHost.jvm.cs    
2006-11-29 10:55:23 UTC (rev 68654)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/MyHost.jvm.cs    
2006-11-29 11:41:40 UTC (rev 68655)
@@ -81,7 +81,17 @@
 
                        WebResponse response = null;
                        try {
-                               response = wr.GetResponse ();
+                               try {
+                                       response = wr.GetResponse ();
+                               }
+                               catch (WebException we) {
+                                       //StreamReader sr = new StreamReader 
(we.Response.GetResponseStream ());
+                                       //throw new WebException (we.Message + 
Environment.NewLine
+                                       //        + "Response:" + 
Environment.NewLine + sr.ReadToEnd (), we);
+                                       response = we.Response;
+                                       if (((HttpWebResponse) 
response).StatusCode == HttpStatusCode.OK)
+                                               throw;//so we don't have a 
false positive test
+                               }
 
                                Exception e = (Exception) Deserialize (
                                        response.Headers[EXCEPTION_HEADER]);
@@ -89,13 +99,8 @@
                                        RethrowException (e);
 
                                t.UserData = Deserialize 
(response.Headers[USER_HEADER]);
-                               t.Response = t.Request.ExtractResponse 
(response);
+                                       t.Response = t.Request.ExtractResponse 
(response);
                        }
-                       catch (WebException we) {
-                               StreamReader sr = new StreamReader 
(we.Response.GetResponseStream ());
-                               throw new WebException (we.Message + 
Environment.NewLine
-                                       + "Response:" + Environment.NewLine + 
sr.ReadToEnd (), we);
-                       }
                        finally {
                                if (response != null)
                                        response.Close ();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to