A test I botched in RequestFactoryTest masked that re-using requests
doesn't actually work.  It can't be made to work completely due to the
need for DeltaValueStore to be stable until a response comes, but we
at least don't have to make the clearUsed method public again thanks
to some new judicious bullet proofing.

Also tweaked some method and class names for consistency and less
confusion.

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

Review by: pdr@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8816 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/requestfactory/client/DefaultRequestTransport.java b/user/src/com/google/gwt/requestfactory/client/DefaultRequestTransport.java
index 1fcc82a..bd69058 100644
--- a/user/src/com/google/gwt/requestfactory/client/DefaultRequestTransport.java
+++ b/user/src/com/google/gwt/requestfactory/client/DefaultRequestTransport.java
@@ -67,7 +67,7 @@
     return requestUrl;
   }
 
-  public void send(String payload, Receiver receiver) {
+  public void send(String payload, TransportReceiver receiver) {
     RequestBuilder builder = createRequestBuilder();
     configureRequestBuilder(builder);
 
@@ -110,15 +110,15 @@
 
   /**
    * Creates a RequestCallback that maps the HTTP response onto the
-   * {@link Receiver} interface.
+   * {@link TransportReceiver} interface.
    */
-  protected RequestCallback createRequestCallback(final Receiver receiver) {
+  protected RequestCallback createRequestCallback(final TransportReceiver receiver) {
     return new RequestCallback() {
 
       public void onError(Request request, Throwable exception) {
         postRequestEvent(State.RECEIVED, null);
         wireLogger.log(Level.SEVERE, SERVER_ERROR, exception);
-        receiver.onFailure(exception.getMessage());
+        receiver.onTransportFailure(exception.getMessage());
       }
 
       public void onResponseReceived(Request request, Response response) {
@@ -126,11 +126,11 @@
         try {
           if (200 == response.getStatusCode()) {
             String text = response.getText();
-            receiver.onSuccess(text);
+            receiver.onTransportSuccess(text);
           } else if (Response.SC_UNAUTHORIZED == response.getStatusCode()) {
             String message = "Need to log in";
             wireLogger.finest(message);
-            receiver.onFailure(message);
+            receiver.onTransportFailure(message);
           } else if (response.getStatusCode() > 0) {
             /*
              * During the redirection for logging in, we get a response with no
@@ -140,7 +140,7 @@
             String message = SERVER_ERROR + " " + response.getStatusCode()
                 + " " + response.getText();
             wireLogger.severe(message);
-            receiver.onFailure(message);
+            receiver.onTransportFailure(message);
           }
         } finally {
           postRequestEvent(State.RECEIVED, response);
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigDecimalRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigDecimalRequest.java
index 8faa91e..4dde8b1 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigDecimalRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigDecimalRequest.java
@@ -36,7 +36,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(new BigDecimal(responseText));
+    succeed(new BigDecimal(responseText));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigIntegerRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigIntegerRequest.java
index d2c2454..7a5b80e 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigIntegerRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBigIntegerRequest.java
@@ -37,7 +37,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(new BigDecimal(responseText).toBigInteger());
+    succeed(new BigDecimal(responseText).toBigInteger());
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBooleanRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBooleanRequest.java
index b4a4273..7008629 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractBooleanRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractBooleanRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(Boolean.valueOf(responseText));
+    succeed(Boolean.valueOf(responseText));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractByteRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractByteRequest.java
index 22b5f64..273c0b8 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractByteRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractByteRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(Integer.valueOf(responseText).byteValue());
+    succeed(Integer.valueOf(responseText).byteValue());
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractCharacterRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractCharacterRequest.java
index ab469e1..3769a93 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractCharacterRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractCharacterRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(responseText.charAt(0));
+    succeed(responseText.charAt(0));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractDateRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractDateRequest.java
index 8ee7761..8d2bc8c 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractDateRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractDateRequest.java
@@ -36,7 +36,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(new Date(Long.valueOf(responseText)));
+    succeed(new Date(Long.valueOf(responseText)));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractDoubleRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractDoubleRequest.java
index ff22ed9..64c8598 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractDoubleRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractDoubleRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(Double.valueOf(responseText));
+    succeed(Double.valueOf(responseText));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractEnumRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractEnumRequest.java
index 36387a8..58f66bf 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractEnumRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractEnumRequest.java
@@ -42,7 +42,7 @@
     int ordinal = Integer.valueOf(responseText);
     for (E e : enumValues) {
       if (ordinal == e.ordinal()) {
-        receiver.onSuccess(ordinal);
+        succeed(ordinal);
       }
     }
     throw new IllegalArgumentException("Invalid enum ordinal value " + ordinal);
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractFloatRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractFloatRequest.java
index 6a94270..ee5dd7c 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractFloatRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractFloatRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(Float.valueOf(responseText));
+    succeed(Float.valueOf(responseText));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractIntegerRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractIntegerRequest.java
index cb3db69..d3f62bd 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractIntegerRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractIntegerRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(Integer.valueOf(responseText));
+    succeed(Integer.valueOf(responseText));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonListRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonListRequest.java
index bed6f06..5529107 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonListRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonListRequest.java
@@ -73,6 +73,6 @@
       T proxy = (T) schema.create(jso);
       proxies.add(proxy);
     }
-    receiver.onSuccess(proxies);
+    succeed(proxies);
   }
 }
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonObjectRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonObjectRequest.java
index 29ab810..74822e6 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonObjectRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractJsonObjectRequest.java
@@ -58,6 +58,6 @@
      */
     @SuppressWarnings("unchecked")
     T proxy = (T) schema.create(jso);
-    receiver.onSuccess(proxy);
+    succeed(proxy);
   }
 }
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractLongRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractLongRequest.java
index eed7468..8d4a075 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractLongRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractLongRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(Long.valueOf(responseText));
+    succeed(Long.valueOf(responseText));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractPrimitiveRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractPrimitiveRequest.java
index 64525bb..cb01886 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractPrimitiveRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractPrimitiveRequest.java
@@ -24,11 +24,12 @@
  * Abstract implementation of
  * {@link com.google.gwt.requestfactory.shared.RequestFactory.RequestObject
  * RequestFactory.RequestObject} for requests that return non-record types.
+ * 
  * @param <T> return type
  * @param <R> type of this request object
  */
-public abstract class AbstractPrimitiveRequest<T, R extends AbstractRequest<T, R>> extends
-    AbstractRequest<T, R> {
+public abstract class AbstractPrimitiveRequest<T, R extends AbstractRequest<T, R>>
+    extends AbstractRequest<T, R> {
 
   public AbstractPrimitiveRequest(RequestFactoryJsonImpl requestFactory) {
     super(requestFactory);
@@ -39,5 +40,9 @@
     handlePrimitiveResult(asString(result));
   }
 
+  /**
+   * Process the response and call {@link #succeed(Object) or
+   * #fail(com.google.gwt.requestfactory.shared.ServerFailure).
+   */
   protected abstract void handlePrimitiveResult(String responseText);
 }
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java
index 063c4a5..a6202b9 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java
@@ -52,7 +52,7 @@
 
   protected final RequestFactoryJsonImpl requestFactory;
   protected DeltaValueStoreJsonImpl deltaValueStore;
-  protected Receiver<T> receiver;
+  private Receiver<T> receiver;
 
   private final Set<String> propertyRefs = new HashSet<String>();
 
@@ -76,7 +76,7 @@
     this.receiver = receiver;
     requestFactory.fire(this);
   }
-
+  
   /**
    * @deprecated use {@link #with(String...)} instead.
    * @param properties
@@ -88,7 +88,7 @@
     }
     return getThis();
   }
-
+  
   /**
    * @return the properties
    */
@@ -100,9 +100,9 @@
 
   public void handleResponseText(String responseText) {
     JsonResults results = JsonResults.fromResults(responseText);
-    if (results.getException() != null) {
-      ServerFailureRecord cause = results.getException();
-      receiver.onFailure(new ServerFailure(
+    JsonServerException cause = results.getException();
+    if (cause != null) {
+      fail(new ServerFailure(
           cause.getMessage(), cause.getType(), cause.getTrace()));
       return;
     }
@@ -149,6 +149,7 @@
         }
       }
 
+      deltaValueStore.reuse();
       receiver.onViolation(errors);
     } else {
       deltaValueStore.commit(results.getSideEffects());
@@ -180,12 +181,21 @@
     return String.valueOf(jso);
   }
 
+  protected void fail(ServerFailure failure) {
+    deltaValueStore.reuse();
+    receiver.onFailure(failure);
+  }
+
   /**
    * Subclasses must override to return {@code this}, to allow builder-style
    * methods to do the same.
    */
   protected abstract R getThis();
 
+  /**
+   * Process the response and call {@link #succeed(Object) or
+   * #fail(com.google.gwt.requestfactory.shared.ServerFailure).
+   */
   protected abstract void handleResult(Object result);
 
   protected native void processRelated(JavaScriptObject related) /*-{
@@ -197,4 +207,8 @@
       this.@com.google.gwt.requestfactory.client.impl.AbstractRequest::pushToValueStore(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)(schemaAndId[0], jso);
     }
   }-*/;
+
+  protected void succeed(T t) {
+    receiver.onSuccess(t);
+  }
 }
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractShortRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractShortRequest.java
index d52d35f..de9b64d 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractShortRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractShortRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(Short.valueOf(responseText));
+    succeed(Short.valueOf(responseText));
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractStringRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractStringRequest.java
index 327a6da..71fd807 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractStringRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractStringRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(responseText);
+    succeed(responseText);
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/AbstractVoidRequest.java b/user/src/com/google/gwt/requestfactory/client/impl/AbstractVoidRequest.java
index 0c05b6e..214138a 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/AbstractVoidRequest.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/AbstractVoidRequest.java
@@ -34,7 +34,7 @@
 
   @Override
   public void handlePrimitiveResult(String responseText) {
-    receiver.onSuccess(null);
+    succeed(null);
   }
 
   @Override
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImpl.java b/user/src/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImpl.java
index 98666ac..cb3e8f9 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImpl.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImpl.java
@@ -113,6 +113,8 @@
 
   private final Map<EntityProxyId, WriteOperation> operations = new HashMap<EntityProxyId, WriteOperation>();
 
+  private boolean used = false;
+
   public DeltaValueStoreJsonImpl(ValueStoreJsonImpl master,
       RequestFactoryJsonImpl requestFactory) {
     this.master = master;
@@ -146,8 +148,14 @@
             futureKey.schema, futureKey.id);
         requestFactory.futureToDatastoreMap.put(futureKey.id, newRecord.getId());
 
-        // TODO (amitmanjhi): get all the data from the server.
-        // make a copy of value and set the id there.
+        /*
+         * TODO (amitmanjhi): get all the data from the server. make a copy of
+         * value and set the id there.
+         * 
+         * When this happens, can the used flag go away? It's only needed now to
+         * ensure that the dvs is in the same state when the response comes back
+         * as it was when the request left.
+         */
         ProxyJsoImpl value = creates.get(futureKey);
         if (value != null) {
           copy.merge(value);
@@ -210,8 +218,16 @@
     return !operations.isEmpty();
   }
 
+  /**
+   * Reset the used flag. To be called only when an unsuccessful reponse has
+   * been received after a {@link #toJson()} string has been sent to the server.
+   */
+  public void reuse() {
+    used = false;
+  }
+
   public <V> void set(Property<V> property, EntityProxy record, V value) {
-    checkArgumentsAndState(record);
+    assertNotUsedAndCorrectType(record);
     ProxyImpl recordImpl = (ProxyImpl) record;
     EntityProxyId recordKey = recordImpl.stableId();
 
@@ -261,7 +277,15 @@
     }
   }
 
+  /**
+   * Has side effect of setting the used flag, meaning further 
+   * sets will fail until clearUsed is called. Cannot be called
+   * while used.
+   */
   String toJson() {
+    assertNotUsed();
+    
+    used = true;
     StringBuffer jsonData = new StringBuffer("{");
     for (WriteOperation writeOperation : new WriteOperation[] {
         WriteOperation.CREATE, WriteOperation.UPDATE}) {
@@ -294,7 +318,16 @@
     return false;
   }
 
-  private void checkArgumentsAndState(EntityProxy record) {
+  private void assertNotUsed() {
+    if (used) {
+      throw new IllegalStateException("Cannot refire request before "
+          + "response received, or after successful response");
+    }
+  }
+
+  private void assertNotUsedAndCorrectType(EntityProxy record) {
+    assertNotUsed();
+    
     if (!(record instanceof ProxyImpl)) {
       throw new IllegalArgumentException(record + " + must be an instance of "
           + ProxyImpl.class);
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/JsonResults.java b/user/src/com/google/gwt/requestfactory/client/impl/JsonResults.java
index a39db1e..ccc18a8 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/JsonResults.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/JsonResults.java
@@ -21,9 +21,9 @@
 /**
  * JSO to hold result and related objects.
  */
-public class JsonResults extends JavaScriptObject {
+class JsonResults extends JavaScriptObject {
 
-  public static native JsonResults fromResults(String json) /*-{
+  static native JsonResults fromResults(String json) /*-{
     // TODO: clean this
     eval("xyz=" + json);
     return xyz;
@@ -32,23 +32,23 @@
   protected JsonResults() {
   }
 
-  public final native ServerFailureRecord getException() /*-{
+  final native JsonServerException getException() /*-{
     return this.exception || null;
   }-*/;
 
-  public final native JavaScriptObject getRelated() /*-{
+  final native JavaScriptObject getRelated() /*-{
     return this.related;
   }-*/;
 
-  public final native Object getResult() /*-{
+  final native Object getResult() /*-{
     return Object(this.result);
   }-*/;
 
-  public final native JavaScriptObject getSideEffects() /*-{
+  final native JavaScriptObject getSideEffects() /*-{
     return this.sideEffects;
   }-*/;
   
-  public final native JsArray<DeltaValueStoreJsonImpl.ReturnRecord> getViolations()/*-{
+  final native JsArray<DeltaValueStoreJsonImpl.ReturnRecord> getViolations()/*-{
     return this.violations || null;
   }-*/;
 }
\ No newline at end of file
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/ServerFailureRecord.java b/user/src/com/google/gwt/requestfactory/client/impl/JsonServerException.java
similarity index 90%
rename from user/src/com/google/gwt/requestfactory/client/impl/ServerFailureRecord.java
rename to user/src/com/google/gwt/requestfactory/client/impl/JsonServerException.java
index 1042c35..af0ef1a 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/ServerFailureRecord.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/JsonServerException.java
@@ -20,9 +20,9 @@
 /**
  * Contains details of a server error.
  */
-public final class ServerFailureRecord extends JavaScriptObject {
+ final class JsonServerException extends JavaScriptObject {
 
-  protected ServerFailureRecord() {
+  protected JsonServerException() {
   }
 
   public native String getMessage() /*-{
diff --git a/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java b/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
index 4adf742..c8d5a3b 100644
--- a/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
+++ b/user/src/com/google/gwt/requestfactory/client/impl/RequestFactoryJsonImpl.java
@@ -109,14 +109,15 @@
     final AbstractRequest<?, ?> abstractRequest = (AbstractRequest<?, ?>) requestObject;
     RequestData requestData = ((AbstractRequest<?, ?>) requestObject).getRequestData();
     Map<String, String> requestMap = requestData.getRequestMap(abstractRequest.deltaValueStore.toJson());
+
     String payload = ClientRequestHelper.getRequestString(requestMap);
-    transport.send(payload, new RequestTransport.Receiver() {
-      public void onFailure(String message) {
-        abstractRequest.receiver.onFailure(new ServerFailure(message, null,
+    transport.send(payload, new RequestTransport.TransportReceiver() {
+      public void onTransportFailure(String message) {
+        abstractRequest.fail(new ServerFailure(message, null,
             null));
       }
 
-      public void onSuccess(String payload) {
+      public void onTransportSuccess(String payload) {
         abstractRequest.handleResponseText(payload);
       }
     });
diff --git a/user/src/com/google/gwt/requestfactory/shared/RequestTransport.java b/user/src/com/google/gwt/requestfactory/shared/RequestTransport.java
index f184f08..8cbf318 100644
--- a/user/src/com/google/gwt/requestfactory/shared/RequestTransport.java
+++ b/user/src/com/google/gwt/requestfactory/shared/RequestTransport.java
@@ -25,14 +25,14 @@
   /**
    * A callback interface.
    */
-  public interface Receiver {
-    void onSuccess(String payload);
+  public interface TransportReceiver {
+    void onTransportSuccess(String payload);
 
-    void onFailure(String message);
+    void onTransportFailure(String message);
   }
 
   /**
    * Called by the RequestFactory implementation.
    */
-  void send(String payload, Receiver receiver);
+  void send(String payload, TransportReceiver receiver);
 }
diff --git a/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java b/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java
index 304a0c0..c560e54 100644
--- a/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java
+++ b/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java
@@ -48,7 +48,7 @@
     persistRay.fire(new Receiver<SimpleFooProxy>() {
       @Override
       public void onFailure(ServerFailure error) {
-        assertEquals("test message", error.getMessage());
+        assertEquals("THIS EXCEPTION IS EXPECTED BY A TEST", error.getMessage());
         assertEquals("java.lang.UnsupportedOperationException",
             error.getExceptionType());
         assertFalse(error.getStackTraceString().isEmpty());
diff --git a/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java b/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
index 2fe5e68..9036b7f 100644
--- a/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
+++ b/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
@@ -1,12 +1,12 @@
 /*
  * Copyright 2010 Google Inc.
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- *
+ * 
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,13 +16,11 @@
 package com.google.gwt.requestfactory.client;
 
 import com.google.gwt.requestfactory.client.impl.ProxyImpl;
-import com.google.gwt.requestfactory.shared.EntityProxyId;
 import com.google.gwt.requestfactory.shared.Receiver;
 import com.google.gwt.requestfactory.shared.RequestObject;
 import com.google.gwt.requestfactory.shared.ServerFailure;
 import com.google.gwt.requestfactory.shared.SimpleBarProxy;
 import com.google.gwt.requestfactory.shared.SimpleFooProxy;
-
 import com.google.gwt.requestfactory.shared.Violation;
 
 import java.util.Set;
@@ -35,19 +33,23 @@
    * DO NOT USE finishTest(). Instead, call finishTestAndReset();
    */
 
-  private class ShouldNotSuccedReceiver<T> extends Receiver<T> {
+  private class FailFixAndRefire<T> extends Receiver<T> {
 
-    private final EntityProxyId expectedId;
+    private final SimpleFooProxy proxy;
+    private final RequestObject<T> request;
+    private boolean voidReturnExpected;
 
-    public ShouldNotSuccedReceiver(EntityProxyId expectedId) {
-      this.expectedId = expectedId;
+    FailFixAndRefire(SimpleFooProxy proxy,
+        RequestObject<T> request) {
+      this.proxy = request.edit(proxy);
+      this.request = request;
     }
 
     @Override
     public void onSuccess(T response) {
       /*
        * Make sure your class path includes:
-       *
+       * 
        * tools/lib/apache/log4j/log4j-1.2.16.jar
        * tools/lib/hibernate/validator/hibernate-validator-4.1.0.Final.jar
        * tools/lib/slf4j/slf4j-api/slf4j-api-1.6.1.jar
@@ -59,13 +61,40 @@
 
     @Override
     public void onViolation(Set<Violation> errors) {
+      
+      // size violation expected
+      
       assertEquals(1, errors.size());
       Violation error = errors.iterator().next();
       assertEquals("userName", error.getPath());
       assertEquals("size must be between 3 and 30", error.getMessage());
-      assertEquals(
-          "Did not receive expeceted id", expectedId, error.getProxyId());
-      finishTestAndReset();
+      assertEquals(proxy.stableId(), error.getProxyId());
+
+      // Now re-used the request to fix the edit 
+      
+      proxy.setUserName("long enough");
+      request.fire(new Receiver<T>() {
+        @Override
+        public void onSuccess(T response) {
+          if (voidReturnExpected) {
+            assertNull(response);
+          } else {
+            assertEquals(proxy.stableId(),
+                ((SimpleFooProxy) response).stableId());
+          }
+          finishTestAndReset();
+        }
+      });
+    }
+
+    void doVoidTest() {
+      voidReturnExpected = true;
+      doTest();
+    }
+    
+    void doTest() {
+      proxy.setUserName("a"); // too short
+      request.fire(this);
     }
   }
 
@@ -81,7 +110,8 @@
     Object futureId = foo.getId();
     assertEquals(futureId, foo.getId());
     assertTrue(((ProxyImpl) foo).isFuture());
-        RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(foo);
+    RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
+        foo);
     fooReq.fire(new Receiver<SimpleFooProxy>() {
 
       @Override
@@ -143,15 +173,16 @@
 
           @Override
           public void onSuccess(SimpleFooProxy newFoo) {
-            final RequestObject<Long> fooReq = req.simpleFooRequest().countSimpleFooWithUserNameSideEffect(newFoo);
-            newFoo = fooReq.edit(newFoo);
+            final RequestObject<Long> mutateRequest = req.simpleFooRequest().countSimpleFooWithUserNameSideEffect(
+                newFoo);
+            newFoo = mutateRequest.edit(newFoo);
             newFoo.setUserName("Ray");
-            fooReq.fire(new Receiver<Long>() {
+            mutateRequest.fire(new Receiver<Long>() {
               @Override
               public void onSuccess(Long response) {
+                assertCannotFire(mutateRequest);
                 assertEquals(new Long(1L), response);
-                // TODO: listen to create events instead.
-                // confirm that there was a sideEffect.
+                // TODO: listen to create events also
 
                 // confirm that the instance method did have the desired
                 // sideEffect.
@@ -164,31 +195,15 @@
                       }
                     });
               }
+
             });
 
-            /*
-             * Firing the request a second time just to show that we can. Note
-             * that we *do not* try to change the value, as we're unclear which
-             * response will come back first, and who should win. That's not the
-             * point. The point is that both callbacks get called.
-             */
-            newFoo.setUserName("Barney"); // Just to prove we can, used to
-                                          // fail assert
-            newFoo.setUserName("Ray"); // Change it back to diminish chance of
-                                       // flakes
-            fooReq.fire(new Receiver<Long>() {
-              @Override
-              public void onSuccess(Long response) {
-                req.simpleFooRequest().findSimpleFooById(999L).fire(
-                    new Receiver<SimpleFooProxy>() {
-                      @Override
-                      public void onSuccess(SimpleFooProxy finalFoo) {
-                        assertEquals("Ray", finalFoo.getUserName());
-                        finishTestAndReset();
-                      }
-                    });
-              }
-            });
+            try {
+              newFoo.setUserName("Barney");
+              fail();
+            } catch (IllegalStateException e) {
+              /* pass, cannot change a request that is in flight */
+            }
           }
         });
   }
@@ -254,8 +269,8 @@
                   @Override
                   public void onSuccess(SimpleFooProxy finalFooProxy) {
                     // barReq hasn't been persisted, so old value
-                    assertEquals(
-                        "FOO", finalFooProxy.getBarField().getUserName());
+                    assertEquals("FOO",
+                        finalFooProxy.getBarField().getUserName());
                     finishTestAndReset();
                   }
                 });
@@ -312,12 +327,14 @@
     SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
     SimpleBarProxy newBar = req.create(SimpleBarProxy.class);
 
-    final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(newFoo);
+    final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
+        newFoo);
 
     newFoo = fooReq.edit(newFoo);
     newFoo.setUserName("Ray");
 
-    final RequestObject<SimpleBarProxy> barReq = req.simpleBarRequest().persistAndReturnSelf(newBar);
+    final RequestObject<SimpleBarProxy> barReq = req.simpleBarRequest().persistAndReturnSelf(
+        newBar);
     newBar = barReq.edit(newBar);
     newBar.setUserName("Amit");
 
@@ -339,8 +356,8 @@
                     "barField.userName").fire(new Receiver<SimpleFooProxy>() {
                   @Override
                   public void onSuccess(SimpleFooProxy finalFooProxy) {
-                    assertEquals(
-                        "Amit", finalFooProxy.getBarField().getUserName());
+                    assertEquals("Amit",
+                        finalFooProxy.getBarField().getUserName());
                     finishTestAndReset();
                   }
                 });
@@ -356,7 +373,8 @@
     delayTestFinish(5000);
 
     SimpleFooProxy rayFoo = req.create(SimpleFooProxy.class);
-    final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(rayFoo);
+    final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(
+        rayFoo);
     rayFoo = persistRay.edit(rayFoo);
     rayFoo.setUserName("Ray");
     rayFoo.setFooField(rayFoo);
@@ -372,7 +390,8 @@
     delayTestFinish(5000);
 
     SimpleFooProxy rayFoo = req.create(SimpleFooProxy.class);
-    final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(rayFoo);
+    final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(
+        rayFoo);
     rayFoo = persistRay.edit(rayFoo);
     rayFoo.setUserName("Ray");
 
@@ -380,7 +399,8 @@
       @Override
       public void onSuccess(final SimpleFooProxy persistedRay) {
         SimpleBarProxy amitBar = req.create(SimpleBarProxy.class);
-        final RequestObject<SimpleBarProxy> persistAmit = req.simpleBarRequest().persistAndReturnSelf(amitBar);
+        final RequestObject<SimpleBarProxy> persistAmit = req.simpleBarRequest().persistAndReturnSelf(
+            amitBar);
         amitBar = persistAmit.edit(amitBar);
         amitBar.setUserName("Amit");
 
@@ -388,7 +408,8 @@
           @Override
           public void onSuccess(SimpleBarProxy persistedAmit) {
 
-            final RequestObject<SimpleFooProxy> persistRelationship = req.simpleFooRequest().persistAndReturnSelf(persistedRay).with("barField");
+            final RequestObject<SimpleFooProxy> persistRelationship = req.simpleFooRequest().persistAndReturnSelf(
+                persistedRay).with("barField");
             SimpleFooProxy newRec = persistRelationship.edit(persistedRay);
             newRec.setBarField(persistedAmit);
 
@@ -430,29 +451,40 @@
   public void testServerFailure() {
     delayTestFinish(5000);
 
-    SimpleFooProxy rayFoo = req.create(SimpleFooProxy.class);
-    final RequestObject<SimpleFooProxy> persistRay = req.simpleFooRequest().persistAndReturnSelf(rayFoo);
-    rayFoo = persistRay.edit(rayFoo);
-    // 42 is the crash causing magic number
-    rayFoo.setPleaseCrash(42);
+    SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
+    final RequestObject<SimpleFooProxy> persistRequest = 
+      req.simpleFooRequest().persistAndReturnSelf(newFoo);
 
-    persistRay.fire(new Receiver<SimpleFooProxy>() {
+    final SimpleFooProxy mutableFoo = persistRequest.edit(newFoo);
+    mutableFoo.setPleaseCrash(42); // 42 is the crash causing magic number
+
+    persistRequest.fire(new Receiver<SimpleFooProxy>() {
       @Override
       public void onFailure(ServerFailure error) {
-        assertEquals("Server Error: test message", error.getMessage());
+        assertEquals("Server Error: THIS EXCEPTION IS EXPECTED BY A TEST", error.getMessage());
         assertEquals("", error.getExceptionType());
         assertEquals("", error.getStackTraceString());
-        finishTestAndReset();
+
+        // Now show that we can fix the error and try again with the same
+        // request
+
+        mutableFoo.setPleaseCrash(24); // Only 42 crashes
+        persistRequest.fire(new Receiver<SimpleFooProxy>() {
+          @Override
+          public void onSuccess(SimpleFooProxy response) {
+            finishTestAndReset();
+          }
+        });
+      }
+
+      public void onSuccess(SimpleFooProxy response) {
+        fail("Failure expected but onSuccess() was called");
       }
 
       @Override
       public void onViolation(Set<Violation> errors) {
         fail("Failure expected but onViolation() was called");
       }
-
-      public void onSuccess(SimpleFooProxy response) {
-        fail("Failure expected but onSuccess() was called");
-      }
     });
   }
 
@@ -462,7 +494,8 @@
     final SimpleFooProxy foo = req.create(SimpleFooProxy.class);
     final Object futureId = foo.getId();
     assertTrue(((ProxyImpl) foo).isFuture());
-        RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(foo);
+    RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
+        foo);
 
     final SimpleFooProxy newFoo = fooReq.edit(foo);
     assertEquals(futureId, foo.getId());
@@ -485,7 +518,8 @@
         checkStableIdEquals(foo, returned);
         checkStableIdEquals(newFoo, returned);
 
-            RequestObject<SimpleFooProxy> editRequest = req.simpleFooRequest().persistAndReturnSelf(returned);
+        RequestObject<SimpleFooProxy> editRequest = req.simpleFooRequest().persistAndReturnSelf(
+            returned);
         final SimpleFooProxy editableFoo = editRequest.edit(returned);
         editableFoo.setUserName("GWT power user");
         editRequest.fire(new Receiver<SimpleFooProxy>() {
@@ -513,7 +547,6 @@
     fooReq.fire(new Receiver<Void>() {
       @Override
       public void onSuccess(Void ignore) {
-
         finishTestAndReset();
       }
     });
@@ -523,61 +556,60 @@
     delayTestFinish(5000);
 
     SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
-    final RequestObject<Void> fooReq = req.simpleFooRequest().persist(newFoo);
+    final RequestObject<SimpleFooProxy> create = req.simpleFooRequest().persistAndReturnSelf(
+        newFoo);
+    new FailFixAndRefire<SimpleFooProxy>(newFoo, create).doTest();
+  }
 
-    newFoo = fooReq.edit(newFoo);
-    newFoo.setUserName("A"); // will cause constraint violation
+  public void testViolationsOnCreateVoidReturn() {
+    delayTestFinish(5000);
 
-    fooReq.fire(new ShouldNotSuccedReceiver<Void>(newFoo.stableId()));
+    SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
+    final RequestObject<Void> create = req.simpleFooRequest().persist(newFoo);
+    new FailFixAndRefire<Void>(newFoo, create).doVoidTest();
   }
 
   public void testViolationsOnEdit() {
     delayTestFinish(5000);
 
-    SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
-    final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(newFoo);
+    fooCreationRequest().fire(new Receiver<SimpleFooProxy>() {
+      @Override
+      public void onSuccess(SimpleFooProxy returned) {
+        RequestObject<SimpleFooProxy> editRequest = req.simpleFooRequest().persistAndReturnSelf(
+            returned);
+        new FailFixAndRefire<SimpleFooProxy>(returned, editRequest).doTest();
+      }
+    });
+  }
 
-    newFoo = fooReq.edit(newFoo);
-    newFoo.setUserName("GWT User");
+  public void testViolationsOnEditVoidReturn() {
+    delayTestFinish(5000);
 
-    fooReq.fire(new Receiver<SimpleFooProxy>() {
+    fooCreationRequest().fire(new Receiver<SimpleFooProxy>() {
       @Override
       public void onSuccess(SimpleFooProxy returned) {
         RequestObject<Void> editRequest = req.simpleFooRequest().persist(
             returned);
-        SimpleFooProxy editableFoo = editRequest.edit(returned);
-        editableFoo.setUserName("A");
-
-        editRequest.fire(
-            new ShouldNotSuccedReceiver<Void>(returned.stableId()));
+        new FailFixAndRefire<Void>(returned, editRequest).doVoidTest();
       }
     });
   }
 
-  public void testViolationsOnEdit_withReturnValue() {
-    delayTestFinish(5000);
-
-    SimpleFooProxy newFoo = req.create(SimpleFooProxy.class);
-    final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(newFoo);
-
-    newFoo = fooReq.edit(newFoo);
-    newFoo.setUserName("GWT User");
-
-    fooReq.fire(new Receiver<SimpleFooProxy>() {
-      @Override
-      public void onSuccess(SimpleFooProxy returned) {
-            RequestObject<SimpleFooProxy> editRequest = req.simpleFooRequest().persistAndReturnSelf(returned);
-        SimpleFooProxy editableFoo = editRequest.edit(returned);
-        editableFoo.setUserName("A");
-
-        editRequest.fire(
-            new ShouldNotSuccedReceiver<SimpleFooProxy>(returned.stableId()));
-      }
-    });
+  private void assertCannotFire(final RequestObject<Long> mutateRequest) {
+    try {
+      mutateRequest.fire(new Receiver<Long>() {
+        public void onSuccess(Long response) {
+          fail("Should not be called");
+        }
+      });
+      fail("Expected IllegalStateException");
+    } catch (IllegalStateException e) {
+      /* cannot reuse a successful request, mores the pity */
+    }
   }
 
-  private void checkStableIdEquals(
-      SimpleFooProxy expected, SimpleFooProxy actual) {
+  private void checkStableIdEquals(SimpleFooProxy expected,
+      SimpleFooProxy actual) {
     assertNotSame(expected.stableId(), actual.stableId());
     assertEquals(expected.stableId(), actual.stableId());
     assertEquals(expected.stableId().hashCode(), actual.stableId().hashCode());
@@ -586,4 +618,13 @@
     assertNotSame(expected, actual);
     assertFalse(expected.equals(actual));
   }
+
+  private RequestObject<SimpleFooProxy> fooCreationRequest() {
+    SimpleFooProxy originalFoo = req.create(SimpleFooProxy.class);
+    final RequestObject<SimpleFooProxy> fooReq = req.simpleFooRequest().persistAndReturnSelf(
+        originalFoo);
+    originalFoo = fooReq.edit(originalFoo);
+    originalFoo.setUserName("GWT User");
+    return fooReq;
+  }
 }
diff --git a/user/test/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImplTest.java b/user/test/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImplTest.java
index ca2c00c..ccf5ff5 100644
--- a/user/test/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImplTest.java
+++ b/user/test/com/google/gwt/requestfactory/client/impl/DeltaValueStoreJsonImplTest.java
@@ -1,12 +1,12 @@
 /*
  * Copyright 2010 Google Inc.
- *
+ * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- *
+ * 
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -96,9 +96,7 @@
     assertTrue(deltaValueStore.isChanged());
     JSONObject changeProxy = testAndGetChangeProxy(deltaValueStore.toJson(),
         WriteOperation.CREATE);
-    assertEquals(
-        "harry",
-        changeProxy.get("userName").isString().stringValue());
+    assertEquals("harry", changeProxy.get("userName").isString().stringValue());
   }
 
   public void testCreateWithSet() {
@@ -122,13 +120,22 @@
   public void testOperationAfterJson() {
     DeltaValueStoreJsonImpl deltaValueStore = new DeltaValueStoreJsonImpl(
         valueStore, requestFactory);
-    deltaValueStore.set(SimpleFooProxyProperties.userName, new MyProxyImpl(jso),
-        "newHarry");
+    deltaValueStore.set(SimpleFooProxyProperties.userName,
+        new MyProxyImpl(jso), "newHarry");
     assertTrue(deltaValueStore.isChanged());
 
     deltaValueStore.toJson();
-    deltaValueStore.set(SimpleFooProxyProperties.userName, new MyProxyImpl(jso),
-        "harry");
+    try {
+      deltaValueStore.set(SimpleFooProxyProperties.userName, new MyProxyImpl(
+          jso), "harry");
+      fail("expect IllegalStateException");
+    } catch (IllegalStateException e) {
+      /* pass */
+    }
+    deltaValueStore.reuse();
+    deltaValueStore.set(SimpleFooProxyProperties.userName, new MyProxyImpl(
+        jso), "harry");
+    // okay, no exception
   }
 
   public void testSeparateIds() {
@@ -137,7 +144,8 @@
     Long futureId = createProxy.getId();
 
     ProxyImpl mockProxy = new ProxyImpl(ProxyJsoImpl.create(futureId, 1,
-        SimpleRequestFactoryInstance.schema(), SimpleRequestFactoryInstance.impl()), RequestFactoryJsonImpl.NOT_FUTURE);
+        SimpleRequestFactoryInstance.schema(),
+        SimpleRequestFactoryInstance.impl()), RequestFactoryJsonImpl.NOT_FUTURE);
     valueStore.putInValueStore(mockProxy.asJso()); // marked as non-future..
     DeltaValueStoreJsonImpl deltaValueStore = new DeltaValueStoreJsonImpl(
         valueStore, requestFactory);
@@ -154,23 +162,25 @@
     JSONArray createOperationArray = jsonObject.get(
         WriteOperation.CREATE.getUnObfuscatedEnumName()).isArray();
     assertEquals(1, createOperationArray.size());
-    assertEquals("harry", createOperationArray.get(0).isObject().get(
-        SIMPLE_FOO_CLASS_NAME).isObject().get(
+    assertEquals(
+        "harry",
+        createOperationArray.get(0).isObject().get(SIMPLE_FOO_CLASS_NAME).isObject().get(
             SimpleFooProxyProperties.userName.getName()).isString().stringValue());
 
     JSONArray updateOperationArray = jsonObject.get(
         WriteOperation.UPDATE.getUnObfuscatedEnumName()).isArray();
     assertEquals(1, updateOperationArray.size());
-    assertEquals("bovik", updateOperationArray.get(0).isObject().get(
-        SIMPLE_FOO_CLASS_NAME).isObject().get(
+    assertEquals(
+        "bovik",
+        updateOperationArray.get(0).isObject().get(SIMPLE_FOO_CLASS_NAME).isObject().get(
             SimpleFooProxyProperties.userName.getName()).isString().stringValue());
   }
 
   public void testUpdate() {
     DeltaValueStoreJsonImpl deltaValueStore = new DeltaValueStoreJsonImpl(
         valueStore, requestFactory);
-    deltaValueStore.set(SimpleFooProxyProperties.userName, new MyProxyImpl(jso),
-        "harry");
+    deltaValueStore.set(SimpleFooProxyProperties.userName,
+        new MyProxyImpl(jso), "harry");
     assertTrue(deltaValueStore.isChanged());
     JSONObject changeProxy = testAndGetChangeProxy(deltaValueStore.toJson(),
         WriteOperation.UPDATE);
@@ -190,8 +200,8 @@
       }
     }
 
-    JSONArray writeOperationArray = 
-          jsonObject.get(currentWriteOperation.getUnObfuscatedEnumName()).isArray();
+    JSONArray writeOperationArray = jsonObject.get(
+        currentWriteOperation.getUnObfuscatedEnumName()).isArray();
     assertEquals(1, writeOperationArray.size());
 
     JSONObject proxyWithName = writeOperationArray.get(0).isObject();
diff --git a/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java b/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java
index f8fdf2c..e99a5d3 100644
--- a/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java
+++ b/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java
@@ -368,7 +368,7 @@
 
   public void setPleaseCrash(Integer crashIf42) {
     if (crashIf42 == 42) {
-      throw new UnsupportedOperationException("test message");
+      throw new UnsupportedOperationException("THIS EXCEPTION IS EXPECTED BY A TEST");
     }
     pleaseCrashField = crashIf42;
   }