diff options
author | Artur Signell <artur@vaadin.com> | 2012-03-16 13:32:41 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-03-16 13:32:41 +0200 |
commit | f29e9cf029b381333c152d811b0c47bf869614aa (patch) | |
tree | 58141cee06822ec71f872e60bd8248f01d5aa0ec /src/com/vaadin/terminal/gwt/server/JsonCodec.java | |
parent | 26c8a73995c125476dcb6a8892ad567b7dd12784 (diff) | |
download | vaadin-framework-f29e9cf029b381333c152d811b0c47bf869614aa.tar.gz vaadin-framework-f29e9cf029b381333c152d811b0c47bf869614aa.zip |
#8534 Handle null values consistently both from server to client and
from client to server
Diffstat (limited to 'src/com/vaadin/terminal/gwt/server/JsonCodec.java')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/JsonCodec.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/JsonCodec.java b/src/com/vaadin/terminal/gwt/server/JsonCodec.java index 6a2a0750ad..5d2e39f10f 100644 --- a/src/com/vaadin/terminal/gwt/server/JsonCodec.java +++ b/src/com/vaadin/terminal/gwt/server/JsonCodec.java @@ -203,7 +203,7 @@ public class JsonCodec implements Serializable { Paintable paintable = (Paintable) value; return combineTypeAndValue(JsonEncoder.VTYPE_PAINTABLE, idMapper.getPaintableId(paintable)); - } else if (getTransportType(value) != JsonEncoder.VTYPE_NULL) { + } else if (getTransportType(value) != null) { return combineTypeAndValue(getTransportType(value), String.valueOf(value)); } else { @@ -317,16 +317,20 @@ public class JsonCodec implements Serializable { return outerArray; } + /** + * Gets the transport type for the value. Returns null if no transport type + * can be found. + * + * @param value + * @return + * @throws JSONException + */ private static String getTransportType(Object value) throws JSONException { if (null == value) { return JsonEncoder.VTYPE_NULL; } String transportType = typeToTransportType.get(value.getClass()); - if (null != transportType) { - return transportType; - } - throw new JSONException("Unknown object type " - + value.getClass().getName()); + return transportType; } } |