Thomas Broyer has uploaded a new change for review.
https://gwt-review.googlesource.com/2570
Change subject: Fixes a NPE in RF when returning a null entity while the
client used .with().
......................................................................
Fixes a NPE in RF when returning a null entity while the client
used .with().
Fixes issue 8104
Change-Id: I07c4b6d94fd063d76f205070047fd5f9e32c190b
---
M user/src/com/google/web/bindery/requestfactory/server/Resolver.java
M
user/test/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryTest.java
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git
a/user/src/com/google/web/bindery/requestfactory/server/Resolver.java
b/user/src/com/google/web/bindery/requestfactory/server/Resolver.java
index 4658066..764ccc5 100644
--- a/user/src/com/google/web/bindery/requestfactory/server/Resolver.java
+++ b/user/src/com/google/web/bindery/requestfactory/server/Resolver.java
@@ -586,7 +586,7 @@
*/
private Resolution resolveClientValue(Object domainValue, Type
clientType) {
if (domainValue == null) {
- return new Resolution(null);
+ return null;
}
boolean anyType = clientType == null;
@@ -634,7 +634,8 @@
Type elementType =
TypeUtils.getSingleParameterization(Collection.class, clientType);
for (Object o : (Collection<?>) domainValue) {
- accumulator.add(resolveClientValue(o,
elementType).getClientObject());
+ Resolution resolution = resolveClientValue(o, elementType);
+ accumulator.add(resolution == null ? null :
resolution.getClientObject());
}
return makeResolution(accumulator);
}
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 caf6670..daec56e 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
@@ -1272,10 +1272,13 @@
/**
* Ensures that a service method can respond with a null value.
+ * <p>
+ * Also tests that using a with() works as expected; see
+ * https://code.google.com/p/google-web-toolkit/issues/detail?id=8104
*/
public void testNullEntityProxyResult() {
delayTestFinish(DELAY_TEST_FINISH);
- simpleFooRequest().returnNullSimpleFoo().fire(new NullReceiver());
+ simpleFooRequest().returnNullSimpleFoo().with("fooField").fire(new
NullReceiver());
}
public void testNullEntityFieldResult() {
--
To view, visit https://gwt-review.googlesource.com/2570
To unsubscribe, visit https://gwt-review.googlesource.com/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I07c4b6d94fd063d76f205070047fd5f9e32c190b
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Thomas Broyer <t.bro...@gmail.com>
--
--
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.