From f8404b9be9d8f599ae62d0be22aab3e25142796f Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Sat, 14 Mar 2015 15:45:22 +0200 Subject: Remove broken custom String[] serialization (#17146) Change-Id: If40b6c4e979e4258a22a7d2d1af0532d3e8f11bc --- server/src/com/vaadin/server/JsonCodec.java | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'server') diff --git a/server/src/com/vaadin/server/JsonCodec.java b/server/src/com/vaadin/server/JsonCodec.java index fc95accd6e..8b685bb046 100644 --- a/server/src/com/vaadin/server/JsonCodec.java +++ b/server/src/com/vaadin/server/JsonCodec.java @@ -417,7 +417,7 @@ public class JsonCodec implements Serializable { connectorTracker); } else if (JsonConstants.VTYPE_STRINGARRAY.equals(transportType)) { - return decodeStringArray((JsonArray) encodedJsonValue); + return decodeArray(String.class, (JsonArray) encodedJsonValue, null); } // Special Vaadin types @@ -573,15 +573,6 @@ public class JsonCodec implements Serializable { return Enum.valueOf(cls, value.getString()); } - private static String[] decodeStringArray(JsonArray jsonArray) { - int length = jsonArray.length(); - List tokens = new ArrayList(length); - for (int i = 0; i < length; ++i) { - tokens.add(jsonArray.getString(i)); - } - return tokens.toArray(new String[tokens.size()]); - } - private static Object[] decodeObjectArray(Type targetType, JsonArray jsonArray, ConnectorTracker connectorTracker) { List list = decodeList(List.class, true, jsonArray, @@ -659,8 +650,6 @@ public class JsonCodec implements Serializable { toReturn = Json.create(((Number) value).doubleValue()); } else if (value instanceof Character) { toReturn = Json.create(Character.toString((Character) value)); - } else if (value instanceof String[]) { - toReturn = toJsonArray((String[]) value); } else if (value instanceof Collection) { toReturn = encodeCollection(valueType, (Collection) value, connectorTracker); @@ -997,13 +986,4 @@ public class JsonCodec implements Serializable { JSONSerializer serializer = customSerializers.get(value.getClass()); return serializer.serialize(value, connectorTracker); } - - private static JsonArray toJsonArray(String[] array) { - JsonArray jsonArray = Json.createArray(); - for (int i = 0; i < array.length; ++i) { - jsonArray.set(i, array[i]); - } - return jsonArray; - } - } -- cgit v1.2.3