[gwt-contrib] Change in gwt[master]: Proxy IDs have to be the same for a given proxy in the respo...
Thomas Broyer has abandoned this change. Change subject: Proxy IDs have to be the same for a given proxy in the response payload. .. Abandoned Submitted -- To view, visit https://gwt-review.googlesource.com/1770 To unsubscribe, visit https://gwt-review.googlesource.com/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298 Gerrit-PatchSet: 2 Gerrit-Project: gwt Gerrit-Branch: master Gerrit-Owner: Thomas Broyer Gerrit-Reviewer: Brian Slesinsky Gerrit-Reviewer: Matthew Dempsky Gerrit-Reviewer: Thomas Broyer -- -- http://groups.google.com/group/Google-Web-Toolkit-Contributors --- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[gwt-contrib] Change in gwt[master]: Proxy IDs have to be the same for a given proxy in the respo...
Brian Slesinsky has posted comments on this change. Change subject: Proxy IDs have to be the same for a given proxy in the response payload. .. Patch Set 2: Code-Review+1 -- To view, visit https://gwt-review.googlesource.com/1770 To unsubscribe, visit https://gwt-review.googlesource.com/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298 Gerrit-PatchSet: 2 Gerrit-Project: gwt Gerrit-Branch: master Gerrit-Owner: Thomas Broyer Gerrit-Reviewer: Brian Slesinsky Gerrit-Reviewer: Matthew Dempsky Gerrit-Reviewer: Thomas Broyer Gerrit-HasComments: No -- -- http://groups.google.com/group/Google-Web-Toolkit-Contributors --- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[gwt-contrib] Change in gwt[master]: Proxy IDs have to be the same for a given proxy in the respo...
Thomas Broyer has posted comments on this change. Change subject: Proxy IDs have to be the same for a given proxy in the response payload. .. Patch Set 2: The problem is that we have 2 ways of identifying an object: using it's proxy type in both case and either a client ID or server ID. The client ID is scoped to a RequestContext and only used for a) EntityProxies created on the client-side (known as ephemeral ID), b) ValueProxies wherever they come from (ValueProxies don't have IDs, we're synthetizing ones for cross-reference in the request/response payload). For EntityProxies originating from the server, only the server ID is ever used (aka persistent ID). When persisting an EntityProxy created on the client on the server, it's then given a server ID (transitions from ephemeral to persistent ID, and now has both client –so it can be matched back to the proxy on the client-side– and server –so it can be referenced in subsequent requests– IDs). Now to our problem: the SimpleProxyId's hashCode is based on whether it has a client ID or not: if it has one, it's used as the hashCode, otherwise the serverId's hashCode is used. So, when we receive {"T":"type", "S":"serverId", "C":1} and {"T":"type", "S":"serverId"}, they're conceptually identical, but technically have different hashCodes. Because the SimpleProxyId is used as a key to the proxy in a map, those 2 IDs in the same response would map to different proxies (so one of them won't ever be populated; and because proxies are lazily created, but "finalized" only based on a specific list, one of those proxies won't be "finalized" either, and will generate a "don't cross the streams" exception when used in another RequestContext). This patch makes sure we'd always use {"T":"type, "S":"serverId", "C":1} everywhere in the response payload. BTW, SimpleProxyId#equals violates the contract, as it's not symmetric. This is another problem that we hopefully never run into. -- To view, visit https://gwt-review.googlesource.com/1770 To unsubscribe, visit https://gwt-review.googlesource.com/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298 Gerrit-PatchSet: 2 Gerrit-Project: gwt Gerrit-Branch: master Gerrit-Owner: Thomas Broyer Gerrit-Reviewer: Matthew Dempsky Gerrit-Reviewer: Thomas Broyer Gerrit-HasComments: No -- -- http://groups.google.com/group/Google-Web-Toolkit-Contributors --- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[gwt-contrib] Change in gwt[master]: Proxy IDs have to be the same for a given proxy in the respo...
Matthew Dempsky has posted comments on this change. Change subject: Proxy IDs have to be the same for a given proxy in the response payload. .. Patch Set 2: Code-Review+1 I don't completely grok this, but the tests and patch look reasonable to me. -- To view, visit https://gwt-review.googlesource.com/1770 To unsubscribe, visit https://gwt-review.googlesource.com/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298 Gerrit-PatchSet: 2 Gerrit-Project: gwt Gerrit-Branch: master Gerrit-Owner: Thomas Broyer Gerrit-Reviewer: Matthew Dempsky Gerrit-Reviewer: Thomas Broyer Gerrit-HasComments: No -- -- http://groups.google.com/group/Google-Web-Toolkit-Contributors --- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[gwt-contrib] Change in gwt[master]: Proxy IDs have to be the same for a given proxy in the respo...
Thomas Broyer has uploaded a new patch set (#2). Change subject: Proxy IDs have to be the same for a given proxy in the response payload. .. Proxy IDs have to be the same for a given proxy in the response payload. More specifically, IDs of the operation messages have to be the same as those of the IdMessages for the same proxy, so they're deserialized into SimpleProxyIds having the same hashCode and comparing equal: if the ID wasEphemeral, it has to contain both the client and server IDs in all places, not only in operation messages. Fixes issue 7900 Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298 --- M user/src/com/google/web/bindery/requestfactory/server/RequestState.java M user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequestContext.java M user/test/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryTest.java 3 files changed, 68 insertions(+), 1 deletion(-) -- To view, visit https://gwt-review.googlesource.com/1770 To unsubscribe, visit https://gwt-review.googlesource.com/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298 Gerrit-PatchSet: 2 Gerrit-Project: gwt Gerrit-Branch: master Gerrit-Owner: Thomas Broyer Gerrit-Reviewer: Thomas Broyer -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Change in gwt[master]: Proxy IDs have to be the same for a given proxy in the respo...
Thomas Broyer has posted comments on this change. Change subject: Proxy IDs have to be the same for a given proxy in the response payload. .. Patch Set 1: The issue is actually triggered as soon as an entity created within the request context is referenced by one of the returned proxies. The reason is that the IdMessage used to represent the reference, while conceptually equivalent to the OperationMessage for the persisted proxy, is not *technically* equivalent: the OperationMessage has a clientId which is lacking in the IdMessage, so they deserialize to objects with different hashCodes and looking up the object by ID in the map of returned proxies thus fail, and we end up creating two proxies, including one that's never "finalized" (created, never populated, makeImmutable never called) -- To view, visit https://gwt-review.googlesource.com/1770 To unsubscribe, visit https://gwt-review.googlesource.com/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298 Gerrit-PatchSet: 1 Gerrit-Project: gwt Gerrit-Branch: master Gerrit-Owner: Thomas Broyer Gerrit-Reviewer: Thomas Broyer Gerrit-HasComments: No -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Change in gwt[master]: Proxy IDs have to be the same for a given proxy in the respo...
Thomas Broyer has uploaded a new change for review. https://gwt-review.googlesource.com/1770 Change subject: Proxy IDs have to be the same for a given proxy in the response payload. .. Proxy IDs have to be the same for a given proxy in the response payload. More specifically, IDs of the operation messages have to be the same as those of the IdMessages for the same proxy, so they're deserialized into SimpleProxyIds having the same hashCode and comparing equal: if the ID wasEphemeral, it has to contain both the client and server IDs in all places, not only in operation messages. Fixes issue 7900 Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298 --- M user/src/com/google/web/bindery/requestfactory/server/RequestState.java M user/test/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryTest.java 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/user/src/com/google/web/bindery/requestfactory/server/RequestState.java b/user/src/com/google/web/bindery/requestfactory/server/RequestState.java index 93e7078..c1d698a 100644 --- a/user/src/com/google/web/bindery/requestfactory/server/RequestState.java +++ b/user/src/com/google/web/bindery/requestfactory/server/RequestState.java @@ -157,7 +157,8 @@ /** * EntityCodex support. This method is identical to * {@link IdFactory#getHistoryToken(SimpleProxyId)} except that it - * base64-encodes the server ids. + * base64-encodes the server ids and adds client ids for stable ids + * that were ephemeral. * * XXX: Merge this with AbstsractRequestContext's implementation */ @@ -172,6 +173,9 @@ ref.setStrength(Strength.EPHEMERAL); ref.setClientId(stableId.getClientId()); } else { + if (stableId.wasEphemeral()) { +ref.setClientId(stableId.getClientId()); + } ref.setServerId(SimpleRequestProcessor.toBase64(stableId.getServerId())); } return AutoBeanCodex.encode(bean); diff --git a/user/test/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryTest.java b/user/test/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryTest.java index 90dcd71..caf6670 100644 --- a/user/test/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryTest.java +++ b/user/test/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryTest.java @@ -16,6 +16,7 @@ package com.google.web.bindery.requestfactory.gwt.client; import com.google.web.bindery.autobean.shared.AutoBeanCodex; +import com.google.web.bindery.autobean.shared.AutoBeanUtils; import com.google.web.bindery.requestfactory.shared.EntityProxy; import com.google.web.bindery.requestfactory.shared.EntityProxyChange; import com.google.web.bindery.requestfactory.shared.EntityProxyId; @@ -271,6 +272,63 @@ assertEquals(2, handler.updateEventCount); // two bars persisted. assertEquals(4, handler.totalEventCount); finishTestAndReset(); + } +}); + } + + /** + * See https://code.google.com/p/google-web-toolkit/issues/detail?id=7900 + */ + public void testCreatePersistCascadingAndReturnSelfEditWithReferences() { +delayTestFinish(DELAY_TEST_FINISH); + +SimpleFooRequest context = simpleFooRequest(); +SimpleFooProxy foo = context.create(SimpleFooProxy.class); +SimpleBarProxy bar = context.create(SimpleBarProxy.class); +foo.setBarField(bar); +Request fooReq = context.persistCascadingAndReturnSelf() +.using(foo).with("barField"); +fooReq.fire(new Receiver() { + + @Override + public void onSuccess(SimpleFooProxy returned) { +assertTrue(AutoBeanUtils.getAutoBean(returned).isFrozen()); + assertTrue(AutoBeanUtils.getAutoBean(returned.getBarField()).isFrozen()); + +simpleFooRequest().edit(returned); + +finishTestAndReset(); + } +}); + } + + /** + * See https://code.google.com/p/google-web-toolkit/issues/detail?id=7900 + */ + public void testCreateReferencePersistCascadingAndReturnSelfEdit() { +delayTestFinish(DELAY_TEST_FINISH); + +simpleFooRequest().findSimpleFooById(1L).fire(new Receiver() { + @Override + public void onSuccess(SimpleFooProxy response) { +SimpleFooRequest context = simpleFooRequest(); +SimpleFooProxy foo = context.edit(response); +SimpleBarProxy bar = context.create(SimpleBarProxy.class); +foo.setBarField(bar); +Request fooReq = context.persistCascadingAndReturnSelf() +.using(foo).with("barField"); +fooReq.fire(new Receiver() { + + @Override + public void onSuccess(SimpleFooProxy returned) { +assertTrue(AutoBeanUtils.getAutoBean(returned).isFrozen()); + assertTrue(AutoBeanUtils.getAutoBean(returned.getBarField()).isFrozen()); + +simpleFooRequest().edit(returned); + +finishTestAndReset(); + } +});