Browse Source

Merge "Better error messages for unknown legacy variable types (#10481)"

tags/7.0.0.beta11
Leif Åstrand 11 years ago
parent
commit
a24ae63c00
1 changed files with 14 additions and 1 deletions
  1. 14
    1
      client/src/com/vaadin/client/communication/JsonEncoder.java

+ 14
- 1
client/src/com/vaadin/client/communication/JsonEncoder.java View 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;

Loading…
Cancel
Save