From 24ab3e2d5ff913a2f35c320f3a3092052bd80e0d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 13 Jan 2010 14:16:05 -0800 Subject: [PATCH] Fixed mixed-case use in UserAccounts table. Plus some more sanity checks on filling out the UserAccount data. --- .../UserAccountService/UserAccountService.cs | 32 ++++++++++++------- .../UserAccountServiceBase.cs | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index c55013fa1b..ffb9cca607 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -122,28 +122,36 @@ namespace OpenSim.Services.UserAccountService u.LastName = d.LastName; u.PrincipalID = d.PrincipalID; u.ScopeID = d.ScopeID; - u.Email = d.Data["Email"].ToString(); + if (d.Data.ContainsKey("Email") && d.Data["Email"] != null) + u.Email = d.Data["Email"].ToString(); + else + u.Email = string.Empty; u.Created = Convert.ToInt32(d.Data["Created"].ToString()); - if (d.Data["UserTitle"] != null) + if (d.Data.ContainsKey("UserTitle") && d.Data["UserTitle"] != null) u.UserTitle = d.Data["UserTitle"].ToString(); else u.UserTitle = string.Empty; - string[] URLs = d.Data["ServiceURLs"].ToString().Split(new char[] { ' ' }); - u.ServiceURLs = new Dictionary(); - - foreach (string url in URLs) + if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) { - string[] parts = url.Split(new char[] { '=' }); + string[] URLs = d.Data["ServiceURLs"].ToString().Split(new char[] { ' ' }); + u.ServiceURLs = new Dictionary(); - if (parts.Length != 2) - continue; + foreach (string url in URLs) + { + string[] parts = url.Split(new char[] { '=' }); - string name = System.Web.HttpUtility.UrlDecode(parts[0]); - string val = System.Web.HttpUtility.UrlDecode(parts[1]); + if (parts.Length != 2) + continue; - u.ServiceURLs[name] = val; + string name = System.Web.HttpUtility.UrlDecode(parts[0]); + string val = System.Web.HttpUtility.UrlDecode(parts[1]); + + u.ServiceURLs[name] = val; + } } + else + u.ServiceURLs = new Dictionary(); return u; } diff --git a/OpenSim/Services/UserAccountService/UserAccountServiceBase.cs b/OpenSim/Services/UserAccountService/UserAccountServiceBase.cs index 70ed5941f9..c1a7b768d7 100644 --- a/OpenSim/Services/UserAccountService/UserAccountServiceBase.cs +++ b/OpenSim/Services/UserAccountService/UserAccountServiceBase.cs @@ -42,7 +42,7 @@ namespace OpenSim.Services.UserAccountService { string dllName = String.Empty; string connString = String.Empty; - string realm = "useraccounts"; + string realm = "UserAccounts"; IConfig dbConfig = config.Configs["DatabaseService"]; if (dbConfig != null)