tasque r67 - in trunk: . RtmNet



Author: sharm
Date: Sat May 17 19:29:10 2008
New Revision: 67
URL: http://svn.gnome.org/viewvc/tasque?rev=67&view=rev

Log:
* RtmNet/Rtm.cs: Prevent crash when requests timeout during network
  failure.  Fixes bug #533609, patch courtesy of Charles Schaefer.

Modified:
   trunk/ChangeLog
   trunk/RtmNet/Rtm.cs

Modified: trunk/RtmNet/Rtm.cs
==============================================================================
--- trunk/RtmNet/Rtm.cs	(original)
+++ trunk/RtmNet/Rtm.cs	Sat May 17 19:29:10 2008
@@ -230,9 +230,22 @@
 			if (variables.Length > 0)
 			{
 				req.ContentType = "application/x-www-form-urlencoded";
-				StreamWriter sw = new StreamWriter(req.GetRequestStream());
-				sw.Write(variables);
-				sw.Close();
+				StreamWriter sw = null;
+				try
+				{
+					sw = new StreamWriter(req.GetRequestStream());
+					sw.Write(variables);
+					sw.Close();
+				}
+				catch(WebException ex)
+				{
+					throw new RtmWebException(ex.Message, ex);
+				}
+				finally
+				{
+					if (sw != null)
+						sw.Close();
+				}
 			}
 			else
 			{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]