From 423ff3b94bbbace7092f110b51d8723f7fc25713 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Tue, 27 Apr 2010 10:53:54 +0300 Subject: Removed unused var from InventoryService.cs (-1 warning) --- OpenSim/Services/InventoryService/InventoryService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 0d6577e..fbcd663 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -109,7 +109,7 @@ namespace OpenSim.Services.InventoryService { existingRootFolder = GetRootFolder(user); } - catch (Exception e) + catch /*(Exception e)*/ { // Munch the exception, it has already been reported // -- cgit v1.1 From fb7458be3185802c4511306c0cda7648d702de59 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 25 Apr 2010 10:13:13 +0300 Subject: Minor spelling corrections in MiniModule: "RetreiveAsset" changed to "RetrieveAsset" and 'm_rootSceene' to m_rootScene'. --- .../Scripting/Minimodule/Interfaces/IInventoryItem.cs | 2 +- .../Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs index 5fac189..16cd7e4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs @@ -39,6 +39,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { int Type { get; } UUID AssetID { get; } - T RetreiveAsset() where T : Asset, new(); + T RetrieveAsset() where T : Asset, new(); } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs index 5bf29d7..bf85cbc 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs @@ -39,11 +39,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public class InventoryItem : IInventoryItem { TaskInventoryItem m_privateItem; - Scene m_rootSceene; + Scene m_rootScene; public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) { - m_rootSceene = rootScene; + m_rootScene = rootScene; m_privateItem = internalItem; } @@ -82,9 +82,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public UUID AssetID { get { return m_privateItem.AssetID; } } // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. - public T RetreiveAsset() where T : OpenMetaverse.Assets.Asset, new() + public T RetrieveAsset() where T : OpenMetaverse.Assets.Asset, new() { - AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); + AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString()); T result = new T(); if ((sbyte)result.AssetType != a.Type) -- cgit v1.1 From 806a2555f557e7a05002f67731b1e3105c9aab8b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 25 Apr 2010 17:21:05 +0300 Subject: Spelling in FriendsModule.cs: "filed to load" -> "failed to load" --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 312db38..23d5b3c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (m_FriendsService == null) { - m_log.Error("[FRIENDS]: No Connector defined in section Friends, or filed to load, cannot continue"); + m_log.Error("[FRIENDS]: No Connector defined in section Friends, or failed to load, cannot continue"); throw new Exception("Connector load error"); } -- cgit v1.1 From 8b75302a1e33f1f5cee166dd22d1de44172da509 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Tue, 27 Apr 2010 10:05:17 +0300 Subject: Just a bit of spellchecking in the comments --- OpenSim/Data/MySQL/MySQLInventoryData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 192deb2..e0e9b9c 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -145,7 +145,7 @@ namespace OpenSim.Data.MySQL /// /// Returns a list of the root folders within a users inventory /// - /// The user whos inventory is to be searched + /// The user whose inventory is to be searched /// A list of folder objects public List getUserRootFolders(UUID user) { @@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL { InventoryItemBase item = new InventoryItemBase(); - // TODO: this is to handle a case where NULLs creep in there, which we are not sure is indemic to the system, or legacy. It would be nice to live fix these. + // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. if (reader["creatorID"] == null) { item.CreatorId = UUID.Zero.ToString(); -- cgit v1.1 From aa56953411e04c260fe1938f5f184c775fea72b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 24 Apr 2010 18:52:23 +0300 Subject: Compiler.cs contained method GetCompilerOutput which, apparently, was not used, but exactly the same path was calculated inline. This patch does some minor refactoring by replacing inline path calculation with GetCompilerOutput. This doesn't actually affect anything, just minor prettifying of the code --- OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index d8c0ba5..f719683 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -261,13 +261,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools // } //} - public object GetCompilerOutput(UUID assetID) + public string GetCompilerOutput(string assetID) { return Path.Combine(ScriptEnginesPath, Path.Combine( m_scriptEngine.World.RegionInfo.RegionID.ToString(), FilePrefix + "_compiled_" + assetID + ".dll")); } + public string GetCompilerOutput(UUID assetID) + { + return GetCompilerOutput(assetID.ToString()); + } + /// /// Converts script from LSL to CS and calls CompileFromCSText /// @@ -279,9 +284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools linemap = null; m_warnings.Clear(); - assembly = Path.Combine(ScriptEnginesPath, Path.Combine( - m_scriptEngine.World.RegionInfo.RegionID.ToString(), - FilePrefix + "_compiled_" + asset + ".dll")); + assembly = GetCompilerOutput(asset); if (!Directory.Exists(ScriptEnginesPath)) { -- cgit v1.1 From b49e9eff562076786f68088155c6a0c8b1192e4a Mon Sep 17 00:00:00 2001 From: AlexRa Date: Wed, 28 Apr 2010 13:11:42 +0300 Subject: Fixed comments in Migration.cs: wrong argument order (no change to code) --- OpenSim/Data/Migration.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 0fb9e78..5ca8e44 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs @@ -53,8 +53,8 @@ namespace OpenSim.Data /// When a database driver starts up, it specifies a resource that /// needs to be brought up to the current revision. For instance: /// - /// Migration um = new Migration(Assembly, DbConnection, "Users"); - /// um.Upgrade(); + /// Migration um = new Migration(DbConnection, Assembly, "Users"); + /// um.Update(); /// /// This works out which version Users is at, and applies all the /// revisions past it to it. If there is no users table, all -- cgit v1.1 From be1141f0f7994cb068683e07fe99936025361001 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Wed, 28 Apr 2010 13:40:35 +0300 Subject: Refactoring in Migration.cs: "using()" instead of explicit Dispose() This ensures that 'cmd' gets disposed on errors --- OpenSim/Data/Migration.cs | 108 ++++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 52 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 5ca8e44..06defe4 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs @@ -110,10 +110,11 @@ namespace OpenSim.Data return; // If not, create the migration tables - DbCommand cmd = _conn.CreateCommand(); - cmd.CommandText = _migrations_create; - cmd.ExecuteNonQuery(); - cmd.Dispose(); + using (DbCommand cmd = _conn.CreateCommand()) + { + cmd.CommandText = _migrations_create; + cmd.ExecuteNonQuery(); + } InsertVersion("migrations", 1); } @@ -131,37 +132,37 @@ namespace OpenSim.Data m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); - DbCommand cmd = _conn.CreateCommand(); - foreach (KeyValuePair kvp in migrations) + using (DbCommand cmd = _conn.CreateCommand()) { - int newversion = kvp.Key; - cmd.CommandText = kvp.Value; - // we need to up the command timeout to infinite as we might be doing long migrations. - cmd.CommandTimeout = 0; - try - { - cmd.ExecuteNonQuery(); - } - catch (Exception e) + foreach (KeyValuePair kvp in migrations) { - m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); - m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); - cmd.CommandText = "ROLLBACK;"; - cmd.ExecuteNonQuery(); - } + int newversion = kvp.Key; + cmd.CommandText = kvp.Value; + // we need to up the command timeout to infinite as we might be doing long migrations. + cmd.CommandTimeout = 0; + try + { + cmd.ExecuteNonQuery(); + } + catch (Exception e) + { + m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); + m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); + cmd.CommandText = "ROLLBACK;"; + cmd.ExecuteNonQuery(); + } - if (version == 0) - { - InsertVersion(_type, newversion); - } - else - { - UpdateVersion(_type, newversion); + if (version == 0) + { + InsertVersion(_type, newversion); + } + else + { + UpdateVersion(_type, newversion); + } + version = newversion; } - version = newversion; } - - cmd.Dispose(); } // private int MaxVersion() @@ -200,43 +201,46 @@ namespace OpenSim.Data protected virtual int FindVersion(DbConnection conn, string type) { int version = 0; - DbCommand cmd = conn.CreateCommand(); - try + using (DbCommand cmd = conn.CreateCommand()) { - cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc"; - using (IDataReader reader = cmd.ExecuteReader()) + try { - if (reader.Read()) + cmd.CommandText = "select version from migrations where name='" + type + "' order by version desc"; + using (IDataReader reader = cmd.ExecuteReader()) { - version = Convert.ToInt32(reader["version"]); + if (reader.Read()) + { + version = Convert.ToInt32(reader["version"]); + } + reader.Close(); } - reader.Close(); + } + catch + { + // Something went wrong, so we're version 0 } } - catch - { - // Something went wrong, so we're version 0 - } - cmd.Dispose(); return version; } private void InsertVersion(string type, int version) { - DbCommand cmd = _conn.CreateCommand(); - cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; - m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); - cmd.ExecuteNonQuery(); - cmd.Dispose(); + using (DbCommand cmd = _conn.CreateCommand()) + { + cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; + m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); + cmd.ExecuteNonQuery(); + } } private void UpdateVersion(string type, int version) { - DbCommand cmd = _conn.CreateCommand(); - cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; - m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); - cmd.ExecuteNonQuery(); - cmd.Dispose(); + using (DbCommand cmd = _conn.CreateCommand()) + { + cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; + m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); + cmd.ExecuteNonQuery(); + } } // private SortedList GetAllMigrations() -- cgit v1.1