Author: doll
Date: Wed Jul 16 10:22:22 2008
New Revision: 677350

URL: http://svn.apache.org/viewvc?rev=677350&view=rev
Log:
SHINDIG-428
If opensocial requests come in without keys specified then the code now assigns 
them keys. This fixes a bug in which the non-keyed results were overwriting 
each other. 


Modified:
    incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js

Modified: 
incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js?rev=677350&r1=677349&r2=677350&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js 
(original)
+++ incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js Wed 
Jul 16 10:22:22 2008
@@ -114,10 +114,20 @@
   }
 
   var jsonBatchData = {};
+  var systemKeyIndex = 0;
 
   for (var j = 0; j < totalRequests; j++) {
     var requestObject = requestObjects[j];
 
+    if (!requestObject.key) {
+      requestObject.key = "systemKey" + systemKeyIndex;
+      while (jsonBatchData[requestObject.key]) {
+        // If the key exists, choose another and try again
+        systemKeyIndex++;
+        requestObject.key = "systemKey" + systemKeyIndex;
+      }
+    }
+
     jsonBatchData[requestObject.key] = {url : requestObject.request.url,
       method : requestObject.request.method};
     if (requestObject.request.postData) {


Reply via email to