diff options
author | Marek Habersack <grendel@twistedcode.net> | 2010-04-02 02:25:09 +0400 |
---|---|---|
committer | Marek Habersack <grendel@twistedcode.net> | 2010-04-02 02:25:09 +0400 |
commit | 95181ca17ed19eafb89ac53c6a8fa6d7eb29276d (patch) | |
tree | 7f952eac463ad3750ba4bd4189b5c71edf177adf /mcs | |
parent | 65c1e5d776c1dc885990af6488c40415a31ec6f1 (diff) |
Partial backport of r154672
svn path=/branches/mono-2-6/mcs/; revision=154673
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System.Web/System.Web/ChangeLog | 10 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/HttpApplication.cs | 11 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/HttpException.cs | 22 |
3 files changed, 33 insertions, 10 deletions
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index 83ceae772f7..94f97bd4b66 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,3 +1,13 @@ +2010-04-02 Marek Habersack <mhabersack@novell.com> + + * HttpException.cs: handle situations when current exception is an + instance of a class derived from HttpException and there's no + InnerException. + + * HttpApplication.cs: ProcessError must call ClearError on the + current context after the handler returns without error. Fixes bug + #572469 + 2010-03-30 Gonzalo Paniagua Javier <gonzalo@novell.com> * HttpResponseStream.cs: speed up short writes. diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs index 7701c408e35..8e8065dd80c 100644 --- a/mcs/class/System.Web/System.Web/HttpApplication.cs +++ b/mcs/class/System.Web/System.Web/HttpApplication.cs @@ -864,6 +864,14 @@ namespace System.Web { return null; } + bool ShouldHandleException (Exception e) + { + if (e is ParseException) + return false; + + return true; + } + // // If we catch an error, queue this error // @@ -871,11 +879,12 @@ namespace System.Web { { bool first = context.Error == null; context.AddError (e); - if (first) { + if (first && ShouldHandleException (e)) { EventHandler eh = nonApplicationEvents [errorEvent] as EventHandler; if (eh != null){ try { eh (this, EventArgs.Empty); + context.ClearError (); } catch (ThreadAbortException taex){ context.ClearError (); if (FlagEnd.Value == taex.ExceptionState || HttpRuntime.DomainUnloading) diff --git a/mcs/class/System.Web/System.Web/HttpException.cs b/mcs/class/System.Web/System.Web/HttpException.cs index d50cc3018a4..8ea4832cf30 100644 --- a/mcs/class/System.Web/System.Web/HttpException.cs +++ b/mcs/class/System.Web/System.Web/HttpException.cs @@ -139,13 +139,18 @@ namespace System.Web if (http_code != 404 && http_code != 403) return GetCustomErrorDefaultMessage (); else - return GetDefaultErrorMessage (false); + return GetDefaultErrorMessage (false, null); } - if (!(this.InnerException is HtmlizedException)) - return GetDefaultErrorMessage (true); + Exception ex = GetBaseException (); + if (ex == null) + ex = this; - return GetHtmlizedErrorMessage (); + HtmlizedException htmlException = ex as HtmlizedException; + if (htmlException == null) + return GetDefaultErrorMessage (true, ex); + + return GetHtmlizedErrorMessage (htmlException); } catch (Exception ex) { Console.WriteLine (ex); @@ -301,10 +306,10 @@ table.sampleCode {{width: 100%; background-color: #ffffcc; }} return builder.ToString (); } - string GetDefaultErrorMessage (bool showTrace) + string GetDefaultErrorMessage (bool showTrace, Exception baseEx) { - Exception ex, baseEx; - ex = baseEx = GetBaseException (); + Exception ex; + ex = baseEx; if (ex == null) ex = this; @@ -356,10 +361,9 @@ table.sampleCode {{width: 100%; background-color: #ffffcc; }} return filename; } - string GetHtmlizedErrorMessage () + string GetHtmlizedErrorMessage (HtmlizedException exc) { StringBuilder builder = new StringBuilder (); - HtmlizedException exc = (HtmlizedException) this.InnerException; #if TARGET_J2EE bool isParseException = false; bool isCompileException = false; |