]> source.dussan.org Git - vaadin-framework.git/commitdiff
Better error messages for unknown legacy variable types (#10481) 76/476/1
authorArtur Signell <artur@vaadin.com>
Mon, 10 Dec 2012 09:32:39 +0000 (11:32 +0200)
committerArtur Signell <artur@vaadin.com>
Mon, 10 Dec 2012 09:32:55 +0000 (11:32 +0200)
Change-Id: I22127da446b1035d6b0868d47646af543ea0a876

client/src/com/vaadin/client/communication/JsonEncoder.java

index 07908c814731cfa216b52f9aa4e58e005697bafe..162becf8ff39a9444fd3387ff5b5c9f5df878bea 100644 (file)
@@ -138,7 +138,20 @@ public class JsonEncoder {
         Object value = uidlValue.getValue();
 
         JSONArray jsonArray = new JSONArray();
-        jsonArray.set(0, new JSONString(getTransportType(value)));
+        String transportType = getTransportType(value);
+        if (transportType == null) {
+            /*
+             * This should not happen unless you try to send an unsupported type
+             * in a legacy variable change from the client to the server.
+             */
+            String valueType = null;
+            if (value != null) {
+                valueType = value.getClass().getName();
+            }
+            throw new IllegalArgumentException("Cannot encode object of type "
+                    + valueType);
+        }
+        jsonArray.set(0, new JSONString(transportType));
         jsonArray.set(1, encode(value, true, connection));
 
         return jsonArray;