Author: husted Date: Fri Sep 22 12:02:27 2006 New Revision: 449055 URL: http://svn.apache.org/viewvc?view=rev&rev=449055 Log: OVR-16 Fix HTML alerts to include stack trace.
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Validators/EntryListProcessor.cs struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/PostBuildEvent.bat struts/sandbox/trunk/overdrive/Nexus/Web/AlertLabel.cs struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Validators/EntryListProcessor.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/Nexus/Core/Validators/EntryListProcessor.cs?view=diff&rev=449055&r1=449054&r2=449055 ============================================================================== --- struts/sandbox/trunk/overdrive/Nexus/Core/Validators/EntryListProcessor.cs (original) +++ struts/sandbox/trunk/overdrive/Nexus/Core/Validators/EntryListProcessor.cs Fri Sep 22 12:02:27 2006 @@ -35,8 +35,8 @@ ICollection keys = row.Keys; foreach (string key in keys) { - IProcessorContext _context = new ProcessorContext(key, context); - formatter.ExecuteProcess(_context); + // IProcessorContext _context = new ProcessorContext(key, context); + // formatter.ExecuteProcess(_context); } target.AddEntry(context.Criteria); } Modified: struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/PostBuildEvent.bat URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/PostBuildEvent.bat?view=diff&rev=449055&r1=449054&r2=449055 ============================================================================== --- struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/PostBuildEvent.bat (original) +++ struts/sandbox/trunk/overdrive/Nexus/Test/bin/Debug/PostBuildEvent.bat Fri Sep 22 12:02:27 2006 @@ -1,5 +1,5 @@ @echo off -E:\projects\Apache\struts-current\sandbox\overdrive\Nexus\postbuild.bat E:\projects\Apache\struts-current\sandbox\overdrive\Nexus\Test\bin\Debug\ Nexus.Test Nexus E:\projects\Apache\struts-current\sandbox\overdrive\Nexus\ +C:\projects\Apache\struts-overdrive\sandbox\overdrive\Nexus\postbuild.bat C:\projects\Apache\struts-overdrive\sandbox\overdrive\Nexus\Test\bin\Debug\ Nexus.Test Nexus C:\projects\Apache\struts-overdrive\sandbox\overdrive\Nexus\ if errorlevel 1 goto CSharpReportError goto CSharpEnd :CSharpReportError Modified: struts/sandbox/trunk/overdrive/Nexus/Web/AlertLabel.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/Nexus/Web/AlertLabel.cs?view=diff&rev=449055&r1=449054&r2=449055 ============================================================================== --- struts/sandbox/trunk/overdrive/Nexus/Web/AlertLabel.cs (original) +++ struts/sandbox/trunk/overdrive/Nexus/Web/AlertLabel.cs Fri Sep 22 12:02:27 2006 @@ -16,11 +16,12 @@ /// Set the defaults for this subclass. /// </summary> /// - public AlertLabel() + public AlertLabel() : base() { Suffix = ALERT_SUFFIX; View_Hint = false; - EnableViewState = false; + base.EnableViewState = false; + // http://blogs.msdn.com/scottwil/archive/2005/01/14/353177.aspx } } Modified: struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs?view=diff&rev=449055&r1=449054&r2=449055 ============================================================================== --- struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs (original) +++ struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs Fri Sep 22 12:02:27 2006 @@ -331,7 +331,7 @@ public void ResetControls() { - ControlCollection controls = this.Controls; + ControlCollection controls = Controls; foreach (Control control in controls) { if (IsTextBox(control)) @@ -463,7 +463,7 @@ public void EnableControls() { - EnableControls(this.Controls,true); + EnableControls(Controls,true); } public void DisableControls(ControlCollection controls) @@ -473,7 +473,7 @@ public void DisableControls() { - EnableControls(this.Controls,false); + EnableControls(Controls,false); } private void BindControls(ControlCollection controls, IDictionary dictionary, string prefix, string list_suffix) @@ -537,7 +537,7 @@ public void Bind(IDictionary dictionary) { - BindControls(this.Controls, dictionary, null, ListSuffix); + BindControls(Controls, dictionary, null, ListSuffix); } public void ExecuteBind(ControlCollection controls, IViewHelper helper) @@ -555,7 +555,7 @@ public void ExecuteBind(IViewHelper helper) { - ExecuteBind(this.Controls, helper); + ExecuteBind(Controls, helper); } public IViewHelper ExecuteBind(string command) @@ -633,13 +633,13 @@ public void ReadExecute(ControlCollection controls, IViewHelper helper, bool nullIfEmpty) { - Read(this.Controls, helper.Criteria, nullIfEmpty); + Read(Controls, helper.Criteria, nullIfEmpty); helper.Execute(); } public void ReadExecute(IViewHelper helper, bool nullIfEmpty) { - ReadExecute(this.Controls, helper, nullIfEmpty); + ReadExecute(Controls, helper, nullIfEmpty); } public void ReadExecute(IViewHelper helper) @@ -656,12 +656,12 @@ public IViewHelper Read(string command, bool nullOnEmpty) { - return Read(this.Controls, command, nullOnEmpty); + return Read(Controls, command, nullOnEmpty); } public IViewHelper Read(string command) { - return Read(this.Controls, command, true); + return Read(Controls, command, true); } public IViewHelper ReadExecute(ControlCollection collection, string command, bool nullOnEmpty) @@ -679,12 +679,12 @@ public IViewHelper ReadExecute(string command, bool nullIfEmpty) { - return ReadExecute(this.Controls, command, nullIfEmpty); + return ReadExecute(Controls, command, nullIfEmpty); } public IViewHelper ReadExecute(string command) { - return ReadExecute(this.Controls, command, true); + return ReadExecute(Controls, command, true); } @@ -788,9 +788,9 @@ control.SelectedIndex = -1; SelectItem(control, value); } - catch (NullReferenceException e1) + catch (NullReferenceException okay) { - if (e1 == null) value = string.Empty; // placate the IDE + if (okay==null) throw okay; // Silly, but it placates the IDE } } Modified: struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs?view=diff&rev=449055&r1=449054&r2=449055 ============================================================================== --- struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs (original) +++ struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs Fri Sep 22 12:02:27 2006 @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Text; using Nexus.Core.Helpers; @@ -22,10 +23,37 @@ } return alert; } - + + /** + * Return Fault messages in HTML format. + */ + private string FaultMessages() + { + Exception e = Fault; + StringBuilder fault = new StringBuilder("["); + fault.Append(e.Message); + fault.Append("] "); + fault.Append(e.Source); + fault.Append(e.StackTrace); + return HtmlMessage(fault.ToString()); + } + public override string AlertsText { - get { return HtmlMessageBuilder(Alerts); } + get + { + if (HasFault) + { + string field_messages = HtmlMessageBuilder(Alerts); + StringBuilder alerts = new StringBuilder(field_messages); + alerts.Append(FaultMessages()); + return alerts.ToString(); + } + else + { + return HtmlMessageBuilder(Alerts); + } + } } public override string HintsFor(string id) @@ -48,6 +76,7 @@ /// private string HtmlMessage(object message) { + if (message==null) return null; StringBuilder sb = new StringBuilder("<p>"); sb.Append(message.ToString()); sb.Append("</p>");