From 001bbb0b1641a549ab689d8537757b9f1a530de9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 7 Feb 2013 23:08:19 +0000 Subject: [PATCH] Fix a recent regression in e17392a where JsonSetValue() stopped working (probably other functions as well). Fix is to call through to the no-arg constructor from the string constructor in JsonStore, which I suspect was just forgotten. This was actually picked up by the TestJsonSetValue() regression test failing But this isn't being run on jenkins due to the .net version issue. This commit also puts the full stack trace in logged messages and makes these error level messages instead of info --- .../Scripting/JsonStore/JsonStore.cs | 7 ------- .../Scripting/JsonStore/JsonStoreModule.cs | 18 +++++++++--------- .../Tests/JsonStoreScriptModuleTests.cs | 8 ++++---- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index 0b7b31bd32..2ebb6f36a1 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs @@ -103,13 +103,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore return PathExpressionToKey(ParsePathExpression(path)); } - // ----------------------------------------------------------------- - /// - /// - /// - // ----------------------------------------------------------------- - public JsonStore() : this("") {} - public JsonStore(string value) { m_TakeStore = new List(); diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index e81412ba58..46c5694d25 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs @@ -93,12 +93,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } catch (Exception e) { - m_log.ErrorFormat("[JsonStore] initialization error: {0}",e.Message); + m_log.Error("[JsonStore]: initialization error: {0}", e); return; } if (m_enabled) - m_log.DebugFormat("[JsonStore] module is enabled"); + m_log.DebugFormat("[JsonStore]: module is enabled"); } // ----------------------------------------------------------------- @@ -191,7 +191,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } catch (Exception e) { - m_log.InfoFormat("[JsonStore] Unable to initialize store from {0}; {1}",value,e.Message); + m_log.Error(string.Format("[JsonStore]: Unable to initialize store from {0}", value), e); return false; } @@ -255,7 +255,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } catch (Exception e) { - m_log.InfoFormat("[JsonStore] Path test failed for {0} in {1}; {2}",path,storeID,e.Message); + m_log.Error(string.Format("[JsonStore]: Path test failed for {0} in {1}", path, storeID), e); } return false; @@ -288,7 +288,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } catch (Exception e) { - m_log.InfoFormat("[JsonStore] Unable to assign {0} to {1} in {2}; {3}",value,path,storeID,e.Message); + m_log.Error(string.Format("[JsonStore]: Unable to assign {0} to {1} in {2}", value, path, storeID), e); } return false; @@ -321,7 +321,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } catch (Exception e) { - m_log.InfoFormat("[JsonStore] Unable to remove {0} in {1}; {2}",path,storeID,e.Message); + m_log.Error(string.Format("[JsonStore]: Unable to remove {0} in {1}", path, storeID), e); } return false; @@ -354,7 +354,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } catch (Exception e) { - m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.Message); + m_log.Error("[JsonStore]: unable to retrieve value", e); } return false; @@ -393,7 +393,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } catch (Exception e) { - m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString()); + m_log.Error("[JsonStore] unable to retrieve value", e); } cback(String.Empty); @@ -432,7 +432,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } catch (Exception e) { - m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString()); + m_log.Error("[JsonStore]: unable to retrieve value", e); } cback(String.Empty); diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index 98b562400e..aea94eaf06 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs @@ -205,13 +205,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); - int result = (int)InvokeOp("JsonSetValue", storeId, "Hello", "World"); + int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times"); Assert.That(result, Is.EqualTo(1)); - string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); - Assert.That(value, Is.EqualTo("World")); + string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); + Assert.That(value, Is.EqualTo("Times")); } ///