]> source.dussan.org Git - vaadin-framework.git/commitdiff
Log error for missing RPC manager or target (#8590)
authorArtur Signell <artur@vaadin.com>
Mon, 2 Apr 2012 19:32:49 +0000 (22:32 +0300)
committerArtur Signell <artur@vaadin.com>
Wed, 4 Apr 2012 21:08:19 +0000 (00:08 +0300)
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
src/com/vaadin/terminal/gwt/server/ServerRpcManager.java

index f0c218eff6da2120d781fe4ef352a740e3b93fec..a7bd69d620f2f687233e301166b2c4c2df26dbbd 100644 (file)
@@ -1560,9 +1560,9 @@ public abstract class AbstractCommunicationManager implements Serializable {
         if (c instanceof RpcTarget) {
             ServerRpcManager.applyInvocation((RpcTarget) c, invocation);
         } else {
-            // TODO better exception?
-            throw new RuntimeException("No RPC target for connector "
-                    + invocation.getConnectorId());
+            logger.log(Level.WARNING, "RPC call received for connector "
+                    + c.getClass().getName() + " (" + c.getConnectorId()
+                    + ") but the connector is not a ServerRpcTarget");
         }
     }
 
index 061f079ca073546052a0fa47f03698835c986a75..cdab4b327fd9f838808200c1b07566d57d3e24bc 100644 (file)
@@ -9,6 +9,8 @@ import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import com.vaadin.terminal.gwt.client.Connector;
 import com.vaadin.terminal.gwt.client.communication.MethodInvocation;
@@ -82,14 +84,18 @@ public class ServerRpcManager<T> implements RpcManager {
             if (manager != null) {
                 manager.applyInvocation(invocation);
             } else {
-                throw new RuntimeException(
-                        "RPC call to a target without an RPC manager.");
+                getLogger()
+                        .log(Level.WARNING,
+                                "RPC call received for RpcTarget "
+                                        + target.getClass().getName()
+                                        + " ("
+                                        + invocation.getConnectorId()
+                                        + ") but the target has not registered any RPC interfaces");
             }
         } catch (ClassNotFoundException e) {
-            throw new RuntimeException(
-                    "No RPC manager registered for RPC interface "
-                            + invocation.getInterfaceName() + " of the target "
-                            + target + ".");
+            throw new RuntimeException("Class for RPC interface "
+                    + invocation.getInterfaceName() + " of the target "
+                    + target + " could not be found.");
         }
     }
 
@@ -190,4 +196,8 @@ public class ServerRpcManager<T> implements RpcManager {
         return null;
     }
 
+    private static Logger getLogger() {
+        return Logger.getLogger(ServerRpcManager.class.getName());
+    }
+
 }