diff options
author | Justin Clark-Casey (justincc) | 2013-02-08 21:56:22 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-08 21:56:22 +0000 |
commit | a08e1b60ec4a2d0f25527ee07fbcae635c9f4478 (patch) | |
tree | c1975d2d08b11bf8a33980256294c4645d21628d /OpenSim | |
parent | Don't allow exceptions to propogate from FlotsamAssetCache which may occur wh... (diff) | |
parent | Fix the return values for JsonDestroyStore, JsonRemoveValue, and JsonSetValue. (diff) | |
download | opensim-SC-a08e1b60ec4a2d0f25527ee07fbcae635c9f4478.zip opensim-SC-a08e1b60ec4a2d0f25527ee07fbcae635c9f4478.tar.gz opensim-SC-a08e1b60ec4a2d0f25527ee07fbcae635c9f4478.tar.bz2 opensim-SC-a08e1b60ec4a2d0f25527ee07fbcae635c9f4478.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
3 files changed, 17 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index 5808d46..c7f0001 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | |||
@@ -250,6 +250,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
250 | return true; | 250 | return true; |
251 | } | 251 | } |
252 | 252 | ||
253 | // pkey will be the final element in the path, we pull it out here to make sure | ||
254 | // that the assignment works correctly | ||
253 | string pkey = path.Pop(); | 255 | string pkey = path.Pop(); |
254 | string pexpr = PathExpressionToKey(path); | 256 | string pexpr = PathExpressionToKey(path); |
255 | if (pexpr != "") | 257 | if (pexpr != "") |
@@ -259,7 +261,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
259 | if (result == null) | 261 | if (result == null) |
260 | return false; | 262 | return false; |
261 | 263 | ||
262 | // Check for and extract array references | 264 | // Check pkey, the last element in the path, for and extract array references |
263 | MatchCollection amatches = m_ArrayPattern.Matches(pkey,0); | 265 | MatchCollection amatches = m_ArrayPattern.Matches(pkey,0); |
264 | if (amatches.Count > 0) | 266 | if (amatches.Count > 0) |
265 | { | 267 | { |
@@ -307,16 +309,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
307 | 309 | ||
308 | if (result is OSDMap) | 310 | if (result is OSDMap) |
309 | { | 311 | { |
312 | // this is the assignment case | ||
310 | OSDMap hmap = result as OSDMap; | 313 | OSDMap hmap = result as OSDMap; |
311 | if (ovalue != null) | 314 | if (ovalue != null) |
312 | { | 315 | { |
313 | hmap[hkey] = ovalue; | 316 | hmap[hkey] = ovalue; |
314 | InvokeNextCallback(pexpr + pkey); | 317 | InvokeNextCallback(pexpr + pkey); |
318 | return true; | ||
315 | } | 319 | } |
316 | else if (hmap.ContainsKey(hkey)) | 320 | |
321 | // this is the remove case | ||
322 | if (hmap.ContainsKey(hkey)) | ||
323 | { | ||
317 | hmap.Remove(hkey); | 324 | hmap.Remove(hkey); |
318 | 325 | return true; | |
319 | return true; | 326 | } |
327 | |||
328 | return false; | ||
320 | } | 329 | } |
321 | 330 | ||
322 | return false; | 331 | return false; |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index 3b52e44..3249aa3 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | |||
@@ -239,7 +239,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
239 | if (! m_enabled) return false; | 239 | if (! m_enabled) return false; |
240 | 240 | ||
241 | lock (m_JsonValueStore) | 241 | lock (m_JsonValueStore) |
242 | m_JsonValueStore.Remove(storeID); | 242 | return m_JsonValueStore.Remove(storeID); |
243 | 243 | ||
244 | return true; | 244 | return true; |
245 | } | 245 | } |
@@ -311,8 +311,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
311 | try | 311 | try |
312 | { | 312 | { |
313 | lock (map) | 313 | lock (map) |
314 | if (map.SetValue(path,value,useJson)) | 314 | return map.SetValue(path,value,useJson); |
315 | return true; | ||
316 | } | 315 | } |
317 | catch (Exception e) | 316 | catch (Exception e) |
318 | { | 317 | { |
@@ -344,8 +343,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
344 | try | 343 | try |
345 | { | 344 | { |
346 | lock (map) | 345 | lock (map) |
347 | if (map.RemoveValue(path)) | 346 | return map.RemoveValue(path); |
348 | return true; | ||
349 | } | 347 | } |
350 | catch (Exception e) | 348 | catch (Exception e) |
351 | { | 349 | { |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index 48b4a9f..d75cd32 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -504,7 +504,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
504 | { | 504 | { |
505 | string jsondata = SLUtil.ParseNotecardToString(Encoding.UTF8.GetString(a.Data)); | 505 | string jsondata = SLUtil.ParseNotecardToString(Encoding.UTF8.GetString(a.Data)); |
506 | int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0; | 506 | int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0; |
507 | m_comms.DispatchReply(scriptID,result, "", reqID.ToString()); | 507 | m_comms.DispatchReply(scriptID, result, "", reqID.ToString()); |
508 | return; | 508 | return; |
509 | } | 509 | } |
510 | catch (Exception e) | 510 | catch (Exception e) |