[Mono-bugs] [Bug 45490][Min] New - Problem with Params property

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 26 Jun 2003 11:31:42 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by gonzalo@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=45490

--- shadow/45490	Thu Jun 26 11:31:42 2003
+++ shadow/45490.tmp.12888	Thu Jun 26 11:31:42 2003
@@ -0,0 +1,72 @@
+Bug#: 45490
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gonzalo@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Problem with Params property
+
+Quoted from a message in mavnet-user list:
+
+As for the errors below, the first is from here in the code:
+
+protected void Populate(object target, string name, object val)
+{
+    string firstChar = name.Substring(0, 1);
+    firstChar = firstChar.ToUpper();
+    string propertyName = firstChar + name.Substring(1);
+    ...
+}
+
+it seems that somehow a zero length string is being passed in for name on
+mono.
+
+that call comes from:
+
+
+public void Populate(Object target, NameValueCollection data)
+{
+    if (data == null) return;
+    foreach (string key in data)
+    {
+        this.Populate(target, key, data[key]);
+    }
+}
+
+
+so for some reason, there is an empty key in the dictionary.
+
+one step more into the trace takes us to here:
+
+public override sealed string Go()
+{
+    PropertyPopulator populator = new PropertyPopulator();
+    populator.Populate(this,
+this.ControllerContext.HttpContext.Request.Params);
+    this.ControllerContext.Model = this;
+    return Perform();
+}
+
+for some reason mono seems to be putting an entry into
+HttpContext.Request.Params with an empty key. If this is done for a reason,
+I can easily patch the Populate method above to:
+
+protected void Populate(object target, string name, object val)
+{
+    if (name == null || name.Length == 0)
+        return;
+    string firstChar = name.Substring(0, 1);
+    firstChar = firstChar.ToUpper();
+    string propertyName = firstChar + name.Substring(1);
+    ...
+}