Reviewers: tbroyer,

Description:
When encoding the payload, make sure that we're using the JSONified
version of the object with non-collection encodes; otherwise we'll end
up encoding a String as [Object] in web mode.

Also remove the toString() on JsonSplittable; the proper implementation
of toString allowed the encoding to work in dev mode but not web mode.


Please review this at http://gwt-code-reviews.appspot.com/1628803/

Affected files:
  M user/src/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java
M user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequestContext.java


Index: user/src/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java
===================================================================
--- user/src/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java (revision 10834) +++ user/src/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java (working copy)
@@ -285,14 +285,6 @@
     return array.length();
   }

-  /**
-   * For debugging use only.
-   */
-  @Override
-  public String toString() {
-    return getPayload();
-  }
-
   private synchronized JsonSplittable makeSplittable(Object object) {
     if (JSONObject.NULL.equals(object)) {
       return null;
Index: user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequestContext.java
===================================================================
--- user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequestContext.java (revision 10834) +++ user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequestContext.java (working copy)
@@ -271,11 +271,11 @@
       sb.append("[");
       if (it.hasNext()) {
// TODO: Allow for the encoding of nested collections. See issue 5974.
-        sb.append(nonCollectionEncode(it.next()));
+        sb.append(nonCollectionEncode(it.next()).getPayload());
         while (it.hasNext()) {
           sb.append(",");
// TODO: Allow for the encoding of nested collections. See issue 5974.
-          sb.append(nonCollectionEncode(it.next()));
+          sb.append(nonCollectionEncode(it.next()).getPayload());
         }
       }
       sb.append("]");


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

Reply via email to