aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMic Bowman2013-02-12 11:10:17 -0800
committerMic Bowman2013-02-12 11:10:17 -0800
commit4b8c22ecfaf573b26e1b8f65cb8c95c39c3f519b (patch)
tree432a0c44ffc2ef9dd4b34463561ccc8a3f49b9a7
parentFix handling of string values in JsonSetValueJson(). There are (diff)
downloadopensim-SC_OLD-4b8c22ecfaf573b26e1b8f65cb8c95c39c3f519b.zip
opensim-SC_OLD-4b8c22ecfaf573b26e1b8f65cb8c95c39c3f519b.tar.gz
opensim-SC_OLD-4b8c22ecfaf573b26e1b8f65cb8c95c39c3f519b.tar.bz2
opensim-SC_OLD-4b8c22ecfaf573b26e1b8f65cb8c95c39c3f519b.tar.xz
Adds the parameter for OSD serialization to encode default values. This
makes the JsonStore get/set operations symmetric.
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs2
2 files changed, 8 insertions, 5 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
index 82a4da7..3bad06c 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -131,15 +131,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
131 m_TakeStore = new List<TakeValueCallbackClass>(); 131 m_TakeStore = new List<TakeValueCallbackClass>();
132 m_ReadStore = new List<TakeValueCallbackClass>(); 132 m_ReadStore = new List<TakeValueCallbackClass>();
133 } 133 }
134 134
135 public JsonStore(string value) : this() 135 public JsonStore(string value) : this()
136 { 136 {
137 // This is going to throw an exception if the value is not
138 // a valid JSON chunk. Calling routines should catch the
139 // exception and handle it appropriately
137 if (String.IsNullOrEmpty(value)) 140 if (String.IsNullOrEmpty(value))
138 ValueStore = new OSDMap(); 141 ValueStore = new OSDMap();
139 else 142 else
140 ValueStore = OSDParser.DeserializeJson(value); 143 ValueStore = OSDParser.DeserializeJson(value);
141 } 144 }
142 145
143 // ----------------------------------------------------------------- 146 // -----------------------------------------------------------------
144 /// <summary> 147 /// <summary>
145 /// 148 ///
@@ -574,14 +577,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
574 // The path pointed to an intermediate hash structure 577 // The path pointed to an intermediate hash structure
575 if (result.Type == OSDType.Map) 578 if (result.Type == OSDType.Map)
576 { 579 {
577 value = OSDParser.SerializeJsonString(result as OSDMap); 580 value = OSDParser.SerializeJsonString(result as OSDMap,true);
578 return true; 581 return true;
579 } 582 }
580 583
581 // The path pointed to an intermediate hash structure 584 // The path pointed to an intermediate hash structure
582 if (result.Type == OSDType.Array) 585 if (result.Type == OSDType.Array)
583 { 586 {
584 value = OSDParser.SerializeJsonString(result as OSDArray); 587 value = OSDParser.SerializeJsonString(result as OSDArray,true);
585 return true; 588 return true;
586 } 589 }
587 590
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
index f1ce856..cc13661 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
227 } 227 }
228 catch (Exception e) 228 catch (Exception e)
229 { 229 {
230 m_log.Error(string.Format("[JsonStore]: Unable to initialize store from {0}", value), e); 230 m_log.ErrorFormat("[JsonStore]: Unable to initialize store from {0}", value);
231 return false; 231 return false;
232 } 232 }
233 233