Revision: 8808
Author: [email protected]
Date: Fri Sep 17 05:56:27 2010
Log: Issue ROO-954: Support for transmitting stack traces for sever exceptions.

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

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8808

Added:
/trunk/user/src/com/google/gwt/requestfactory/client/impl/ServerFailureRecord.java /trunk/user/src/com/google/gwt/requestfactory/server/DefaultExceptionHandler.java
 /trunk/user/src/com/google/gwt/requestfactory/server/ExceptionHandler.java
/trunk/user/test/com/google/gwt/requestfactory/RequestFactoryExceptionHandlerTest.gwt.xml /trunk/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java /trunk/user/test/com/google/gwt/requestfactory/server/RequestFactoryExceptionHandlerServlet.java
Modified:
/trunk/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java
 /trunk/user/src/com/google/gwt/requestfactory/client/impl/JsonResults.java
/trunk/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java /trunk/user/src/com/google/gwt/requestfactory/server/RequestFactoryServlet.java
 /trunk/user/src/com/google/gwt/requestfactory/server/RequestProcessor.java
 /trunk/user/src/com/google/gwt/requestfactory/shared/Receiver.java
 /trunk/user/src/com/google/gwt/requestfactory/shared/ServerFailure.java
 /trunk/user/test/com/google/gwt/requestfactory/RequestFactorySuite.java
/trunk/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java /trunk/user/test/com/google/gwt/requestfactory/client/impl/SimpleFooProxyProperties.java
 /trunk/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java
 /trunk/user/test/com/google/gwt/requestfactory/shared/SimpleFooProxy.java

=======================================
--- /dev/null
+++ /trunk/user/src/com/google/gwt/requestfactory/client/impl/ServerFailureRecord.java Fri Sep 17 05:56:27 2010
@@ -0,0 +1,39 @@
+/*
+ * 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
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.requestfactory.client.impl;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+/**
+ * Contains details of a server error.
+ */
+public final class ServerFailureRecord extends JavaScriptObject {
+
+  protected ServerFailureRecord() {
+  }
+
+  public native String getMessage() /*-{
+    return this.message || "";
+  }-*/;
+
+  public native String getTrace() /*-{
+    return this.trace || "";
+  }-*/;
+
+  public native String getType() /*-{
+    return this.type || "";
+  }-*/;
+}
=======================================
--- /dev/null
+++ /trunk/user/src/com/google/gwt/requestfactory/server/DefaultExceptionHandler.java Fri Sep 17 05:56:27 2010
@@ -0,0 +1,30 @@
+/*
+ * 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
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.requestfactory.server;
+
+import com.google.gwt.requestfactory.shared.ServerFailure;
+
+/**
+ * Default implementation for handling exceptions thrown while
+ * processing a request. Suppresses stack traces and the exception
+ * class name.
+ */
+public class DefaultExceptionHandler implements ExceptionHandler {
+  public ServerFailure createServerFailure(Throwable throwable) {
+ return new ServerFailure("Server Error: " + throwable.getMessage(), null,
+        null);
+  }
+}
=======================================
--- /dev/null
+++ /trunk/user/src/com/google/gwt/requestfactory/server/ExceptionHandler.java Fri Sep 17 05:56:27 2010
@@ -0,0 +1,31 @@
+/*
+ * 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
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.requestfactory.server;
+
+import com.google.gwt.requestfactory.shared.ServerFailure;
+
+/**
+ * Handles an exception produced while processing a request.
+ */
+public interface ExceptionHandler {
+  /**
+   * Generates a {...@link ServerFailure} based on the information
+   * contained in the received {...@code exception}.
+   *
+   * @see DefaultExceptionHandler
+   */
+  ServerFailure createServerFailure(Throwable throwable);
+}
=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/requestfactory/RequestFactoryExceptionHandlerTest.gwt.xml Fri Sep 17 05:56:27 2010
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.1/distro-source/core/src/gwt-module.dtd";>
+<!--
+  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
+ License for the specific language governing permissions and limitations under
+  the License.
+-->
+<module>
+  <inherits name='com.google.gwt.requestfactory.RequestFactory'/>
+ <!-- use this old inefficient JSON library just for the time being, replace soon -->
+  <inherits name='com.google.gwt.junit.JUnit'/>
+  <inherits name='com.google.gwt.json.JSON'/>
+  <servlet path='/gwtRequest'
+ class='com.google.gwt.requestfactory.server.RequestFactoryExceptionHandlerServlet' />
+</module>
=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/requestfactory/client/RequestFactoryExceptionHandlerTest.java Fri Sep 17 05:56:27 2010
@@ -0,0 +1,71 @@
+/*
+ * 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
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.requestfactory.client;
+
+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.SimpleFooProxy;
+import com.google.gwt.requestfactory.shared.SyncResult;
+import com.google.gwt.requestfactory.shared.Violation;
+
+import java.util.Set;
+
+/**
+ * Tests that {...@code RequestFactoryServlet} when using a custom
+ * ExceptionHandler.
+ */
+public class RequestFactoryExceptionHandlerTest extends RequestFactoryTest {
+
+  @Override
+  public String getModuleName() {
+ return "com.google.gwt.requestfactory.RequestFactoryExceptionHandlerTest";
+  }
+
+  @Override
+  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);
+
+    persistRay.fire(new Receiver<SimpleFooProxy>() {
+      @Override
+      public void onFailure(ServerFailure error) {
+        assertEquals("test message", error.getMessage());
+        assertEquals("java.lang.UnsupportedOperationException",
+            error.getExceptionType());
+        assertFalse(error.getStackTraceString().isEmpty());
+        finishTestAndReset();
+      }
+
+      @Override
+      public void onViolation(Set<Violation> errors) {
+        fail("Failure expected but onViolation() was called");
+      }
+
+      public void onSuccess(SimpleFooProxy response,
+          Set<SyncResult> syncResult) {
+        fail("Failure expected but onSuccess() was called");
+      }
+    });
+  }
+
+}
=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/requestfactory/server/RequestFactoryExceptionHandlerServlet.java Fri Sep 17 05:56:27 2010
@@ -0,0 +1,34 @@
+/*
+ * 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
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.requestfactory.server;
+
+import com.google.gwt.requestfactory.shared.ServerFailure;
+
+/**
+ * A RequestFactoryServlet that forwards all exception information.
+ */
+public class RequestFactoryExceptionHandlerServlet
+    extends RequestFactoryServlet {
+  public RequestFactoryExceptionHandlerServlet() {
+    super(new ExceptionHandler() {
+      @Override
+      public ServerFailure createServerFailure(Throwable throwable) {
+        return new ServerFailure(throwable.getMessage(),
+            throwable.getClass().getName(), "my stack trace");
+      }
+    });
+  }
+}
=======================================
--- /trunk/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java Thu Sep 16 08:54:56 2010 +++ /trunk/user/src/com/google/gwt/requestfactory/client/impl/AbstractRequest.java Fri Sep 17 05:56:27 2010
@@ -102,7 +102,9 @@
   public void handleResponseText(String responseText) {
     JsonResults results = JsonResults.fromResults(responseText);
     if (results.getException() != null) {
-      receiver.onFailure(new ServerFailure(results.getException()));
+      ServerFailureRecord cause = results.getException();
+      receiver.onFailure(new ServerFailure(
+          cause.getMessage(), cause.getType(), cause.getTrace()));
       return;
     }
     processRelated(results.getRelated());
=======================================
--- /trunk/user/src/com/google/gwt/requestfactory/client/impl/JsonResults.java Mon Sep 13 07:15:23 2010 +++ /trunk/user/src/com/google/gwt/requestfactory/client/impl/JsonResults.java Fri Sep 17 05:56:27 2010
@@ -32,7 +32,7 @@
   protected JsonResults() {
   }

-  public final native String getException() /*-{
+  public final native ServerFailureRecord getException() /*-{
     return this.exception || null;
   }-*/;

=======================================
--- /trunk/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java Thu Sep 16 08:54:56 2010 +++ /trunk/user/src/com/google/gwt/requestfactory/server/JsonRequestProcessor.java Fri Sep 17 05:56:27 2010
@@ -18,6 +18,7 @@
 import com.google.gwt.requestfactory.shared.EntityProxy;
 import com.google.gwt.requestfactory.shared.EntityProxyId;
 import com.google.gwt.requestfactory.shared.ProxyFor;
+import com.google.gwt.requestfactory.shared.ServerFailure;
 import com.google.gwt.requestfactory.shared.WriteOperation;
 import com.google.gwt.requestfactory.shared.impl.Property;
 import com.google.gwt.requestfactory.shared.impl.RequestData;
@@ -131,6 +132,8 @@

   private OperationRegistry operationRegistry;

+  private ExceptionHandler exceptionHandler;
+
   /*
    * <li>Request comes in. Construct the involvedKeys, dvsDataMap and
    * beforeDataMap, using DVS and parameters.
@@ -166,13 +169,12 @@
Logger.getLogger(this.getClass().getName()).finest("Outgoing response "
           + response);
       return response;
+    } catch (InvocationTargetException e) {
+      JSONObject exceptionResponse = buildExceptionResponse(e.getCause());
+      throw new RequestProcessingException("Unexpected exception", e,
+          exceptionResponse.toString());
     } catch (Exception e) {
-      JSONObject exceptionResponse = new JSONObject();
-      try {
-        exceptionResponse.put("exception", "Server error");
-      } catch (JSONException jsonException) {
-        throw new IllegalStateException(jsonException);
-      }
+      JSONObject exceptionResponse = buildExceptionResponse(e);
       throw new RequestProcessingException("Unexpected exception", e,
           exceptionResponse.toString());
     }
@@ -758,6 +760,10 @@
     envelop.put(RequestData.RELATED_TOKEN, encodeRelatedObjectsToJson());
     return envelop;
   }
+
+  public void setExceptionHandler(ExceptionHandler exceptionHandler) {
+    this.exceptionHandler = exceptionHandler;
+  }

   public void setOperationRegistry(OperationRegistry operationRegistry) {
     this.operationRegistry = operationRegistry;
@@ -818,6 +824,32 @@
     relatedObjects.put(keyRef, getJsonObject(returnValue, propertyType,
         propertyContext));
   }
+
+  private JSONObject buildExceptionResponse(Throwable throwable) {
+    JSONObject exceptionResponse = new JSONObject();
+ ServerFailure failure = exceptionHandler.createServerFailure(throwable);
+    try {
+      JSONObject exceptionMessage = new JSONObject();
+
+      String message = failure.getMessage();
+      String exceptionType = failure.getExceptionType();
+      String stackTraceString = failure.getStackTraceString();
+
+      if (message != null && message.length() != 0) {
+        exceptionMessage.put("message", message);
+      }
+      if (exceptionType != null && exceptionType.length() != 0) {
+        exceptionMessage.put("type", exceptionType);
+      }
+      if (stackTraceString != null && stackTraceString.length() != 0) {
+        exceptionMessage.put("trace", stackTraceString);
+      }
+      exceptionResponse.put("exception", exceptionMessage);
+    } catch (JSONException jsonException) {
+      throw new IllegalStateException(jsonException);
+    }
+    return exceptionResponse;
+  }

   @SuppressWarnings("unchecked")
private Class<? extends EntityProxy> castToRecordClass(Class<?> propertyType) {
=======================================
--- /trunk/user/src/com/google/gwt/requestfactory/server/RequestFactoryServlet.java Wed Sep 15 17:53:58 2010 +++ /trunk/user/src/com/google/gwt/requestfactory/server/RequestFactoryServlet.java Fri Sep 17 05:56:27 2010
@@ -74,6 +74,20 @@
   public static HttpServletResponse getThreadLocalResponse() {
     return perThreadResponse.get();
   }
+
+  private final ExceptionHandler exceptionHandler;
+
+  public RequestFactoryServlet() {
+    this(new DefaultExceptionHandler());
+  }
+
+  /**
+   * Use this constructor in subclasses to provide a custom
+   * {...@link ExceptionHandler}.
+   */
+  public RequestFactoryServlet(ExceptionHandler exceptionHandler) {
+    this.exceptionHandler = exceptionHandler;
+  }

   @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
@@ -102,6 +116,7 @@
RequestProcessor<String> requestProcessor = new JsonRequestProcessor(); requestProcessor.setOperationRegistry(new ReflectionBasedOperationRegistry(
               new DefaultSecurityProvider()));
+          requestProcessor.setExceptionHandler(exceptionHandler);
           response.setHeader("Content-Type",
               RequestFactory.JSON_CONTENT_TYPE_UTF8);
writer.print(requestProcessor.decodeAndInvokeRequest(jsonRequestString));
=======================================
--- /trunk/user/src/com/google/gwt/requestfactory/server/RequestProcessor.java Fri Aug 27 13:26:53 2010 +++ /trunk/user/src/com/google/gwt/requestfactory/server/RequestProcessor.java Fri Sep 17 05:56:27 2010
@@ -27,6 +27,15 @@
    */
T decodeAndInvokeRequest(T encodedRequest) throws RequestProcessingException;

+  /**
+   * Sets the ExceptionHandler to use to convert exceptions caused by
+   * method invocations into failure messages sent back to the client.
+   *
+   * @param exceptionHandler an implementation, such as
+   *        {...@code DefaultExceptionHandler}
+   */
+  void setExceptionHandler(ExceptionHandler exceptionHandler);
+
   /**
* Sets the OperationRegistry to be used for looking up invocation metadata.
    *
=======================================
--- /trunk/user/src/com/google/gwt/requestfactory/shared/Receiver.java Tue Sep 14 03:12:23 2010 +++ /trunk/user/src/com/google/gwt/requestfactory/shared/Receiver.java Fri Sep 17 05:56:27 2010
@@ -33,7 +33,13 @@
    * RuntimeException with the provided error message.
    */
   public void onFailure(ServerFailure error) {
-    throw new RuntimeException(error.getMessage());
+    String exceptionType = error.getExceptionType();
+    String message = error.getMessage();
+    throw new RuntimeException(exceptionType
+ + ((exceptionType.length() != 0 && message.length() != 0) ? ": " : "")
+        + error.getMessage()
+ + ((exceptionType.length() != 0 || message.length() != 0) ? ": " : "")
+        + error.getStackTraceString());
   }

   /**
@@ -43,13 +49,14 @@

   /**
* Called if an object sent to the server could not be validated. The default - * implementation calls {...@link #onFailure()} if <code>errors</code> is not
-   * empty.
+   * implementation calls {...@link #onFailure(ServerFailure)} if <code>errors
+   * </code> is not empty.
    */
   public void onViolation(Set<Violation> errors) {
     if (!errors.isEmpty()) {
       onFailure(new ServerFailure(
-          "The call failed on the server due to a ConstraintViolation"));
+          "The call failed on the server due to a ConstraintViolation",
+          "", ""));
     }
   }
 }
=======================================
--- /trunk/user/src/com/google/gwt/requestfactory/shared/ServerFailure.java Tue Sep 14 03:12:23 2010 +++ /trunk/user/src/com/google/gwt/requestfactory/shared/ServerFailure.java Fri Sep 17 05:56:27 2010
@@ -20,19 +20,32 @@
  */
 public class ServerFailure {
   private final String message;
+  private final String stackTraceString;
+  private final String exceptionType;

   /**
    * Constructs a ServerFailure with a null message.
    */
   public ServerFailure() {
-    this(null);
+    this(null, null, null);
   }

-  public ServerFailure(String message) {
+  public ServerFailure(String message, String exceptionType,
+      String stackTraceString) {
     this.message = message;
+    this.exceptionType = exceptionType;
+    this.stackTraceString = stackTraceString;
+  }
+
+  public String getExceptionType() {
+    return exceptionType;
   }

   public String getMessage() {
     return message;
   }
-}
+
+  public String getStackTraceString() {
+    return stackTraceString;
+  }
+}
=======================================
--- /trunk/user/test/com/google/gwt/requestfactory/RequestFactorySuite.java Wed Sep 15 03:48:29 2010 +++ /trunk/user/test/com/google/gwt/requestfactory/RequestFactorySuite.java Fri Sep 17 05:56:27 2010
@@ -18,6 +18,7 @@
 import com.google.gwt.junit.tools.GWTTestSuite;
 import com.google.gwt.requestfactory.client.EditorTest;
 import com.google.gwt.requestfactory.client.FindServiceTest;
+import com.google.gwt.requestfactory.client.RequestFactoryExceptionHandlerTest;
 import com.google.gwt.requestfactory.client.RequestFactoryTest;
import com.google.gwt.requestfactory.client.impl.DeltaValueStoreJsonImplTest;
 import com.google.gwt.requestfactory.client.impl.ProxyJsoImplTest;
@@ -37,6 +38,7 @@
     suite.addTestSuite(ValueStoreJsonImplTest.class);
     suite.addTestSuite(DeltaValueStoreJsonImplTest.class);
     suite.addTestSuite(RequestFactoryTest.class);
+    suite.addTestSuite(RequestFactoryExceptionHandlerTest.class);
     suite.addTestSuite(FindServiceTest.class);
     return suite;
   }
=======================================
--- /trunk/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java Thu Sep 16 08:54:56 2010 +++ /trunk/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java Fri Sep 17 05:56:27 2010
@@ -20,6 +20,7 @@
 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.SyncResult;
@@ -459,6 +460,37 @@
           }
         });
   }
+
+  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);
+
+    persistRay.fire(new Receiver<SimpleFooProxy>() {
+      @Override
+      public void onFailure(ServerFailure error) {
+        assertEquals("Server Error: test message", error.getMessage());
+        assertEquals("", error.getExceptionType());
+        assertEquals("", error.getStackTraceString());
+        finishTestAndReset();
+      }
+
+      @Override
+      public void onViolation(Set<Violation> errors) {
+        fail("Failure expected but onViolation() was called");
+      }
+
+      public void onSuccess(SimpleFooProxy response,
+          Set<SyncResult> syncResult) {
+        fail("Failure expected but onSuccess() was called");
+      }
+    });
+  }

   public void testStableId() {
     delayTestFinish(5000);
=======================================
--- /trunk/user/test/com/google/gwt/requestfactory/client/impl/SimpleFooProxyProperties.java Wed Sep 15 12:32:43 2010 +++ /trunk/user/test/com/google/gwt/requestfactory/client/impl/SimpleFooProxyProperties.java Fri Sep 17 05:56:27 2010
@@ -68,4 +68,6 @@

static final Property<SimpleFooProxy> fooField = new Property<SimpleFooProxy>(
       "fooField", SimpleFooProxy.class);
-}
+
+ static final Property<Integer> pleaseCrash = new Property<Integer>("pleaseCrash", Integer.class);
+}
=======================================
--- /trunk/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java Thu Sep 16 14:14:13 2010 +++ /trunk/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java Fri Sep 17 05:56:27 2010
@@ -125,6 +125,7 @@
   private Boolean boolField;

   private Boolean otherBoolField;
+  private Integer pleaseCrashField;

   private SimpleBar barField;
   private SimpleFoo fooField;
@@ -143,6 +144,7 @@
     boolField = true;
     nullField = null;
     barNullField = null;
+    pleaseCrashField = 0;
   }

   public Long countSimpleFooWithUserNameSideEffect() {
@@ -242,6 +244,10 @@
   public String getPassword() {
     return password;
   }
+
+  public Integer getPleaseCrash() {
+    return pleaseCrashField;
+  }

   /**
    * @return the shortField
@@ -359,6 +365,13 @@
   public void setOtherBoolField(Boolean otherBoolField) {
     this.otherBoolField = otherBoolField;
   }
+
+  public void setPleaseCrash(Integer crashIf42) {
+    if (crashIf42 == 42) {
+      throw new UnsupportedOperationException("test message");
+    }
+    pleaseCrashField = crashIf42;
+  }

   public void setPassword(String password) {
     this.password = password;
=======================================
--- /trunk/user/test/com/google/gwt/requestfactory/shared/SimpleFooProxy.java Tue Sep 14 17:54:04 2010 +++ /trunk/user/test/com/google/gwt/requestfactory/shared/SimpleFooProxy.java Fri Sep 17 05:56:27 2010
@@ -59,6 +59,8 @@

   Boolean getOtherBoolField();

+  Integer getPleaseCrash();
+
   String getPassword();

   Short getShortField();
@@ -97,6 +99,8 @@

   void setPassword(String password);

+  void setPleaseCrash(Integer dummy);
+
   void setShortField(Short s);

   void setUserName(String userName);

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

Reply via email to