Revision: 8854
Author: [email protected]
Date: Thu Sep 23 10:27:34 2010
Log: Fix a corner case in getProxyId. Minor cleanup.

Patch by: amitmanjhi
Review by: robertvawter

Review at http://gwt-code-reviews.appspot.com/914801

http://code.google.com/p/google-web-toolkit/source/detail?r=8854

Modified:
/trunk/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java

=======================================
--- /trunk/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java Wed Sep 22 07:33:27 2010 +++ /trunk/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java Thu Sep 23 10:27:34 2010
@@ -195,7 +195,6 @@
   protected String getHistoryToken(EntityProxyId<?> proxyId,
       ProxyToTypeMap recordToTypeMap) {
     EntityProxyIdImpl<?> entityProxyId = (EntityProxyIdImpl<?>) proxyId;
-    StringBuilder toReturn = new StringBuilder();
     boolean isFuture = false;
     Object tokenId = entityProxyId.encodedId;
     if (entityProxyId.isFuture) {
@@ -209,7 +208,7 @@
         tokenId = persistedId;
       }
     }
-    toReturn = new StringBuilder();
+    StringBuilder toReturn = new StringBuilder();
     toReturn.append(tokenId);
     toReturn.append(HISTORY_TOKEN_SEPARATOR).append(
         entityProxyId.schema.getToken());
@@ -236,7 +235,11 @@
     }

     String id = bits[ID_INDEX];
-    Object futureId = datastoreToFutureMap.get(id, schema);
+    Object futureId = null;
+    if (!isFuture) {
+      // Look in the map only if it is a datastoreId.
+      futureId = datastoreToFutureMap.get(id, schema);
+    }
return new EntityProxyIdImpl<EntityProxy>(id, schema, isFuture, futureId);
   }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to