Fix to JsonUtil to properly handle java Lists

This fixes a bug in FirebaseDB where a list of lists is handed to the
AppendValue block.

Change-Id: I16cd4612f978842e62a719627bc729d8f4a48d90
parent ac692450
......@@ -764,7 +764,7 @@ public class FirebaseDB extends AndroidNonvisibleComponent implements Component
if (value instanceof List) {
((List)value).add(valueToAdd);
try {
value = JsonUtil.getJsonRepresentation(YailList.makeList((List)value));
value = JsonUtil.getJsonRepresentation((List)value);
} catch (JSONException e) {
result.err = "Could not convert value to JSON.";
return Transaction.abort();
......
......@@ -177,6 +177,9 @@ public class JsonUtil {
if (value instanceof Boolean) {
return value.toString();
}
if (value instanceof List) {
value = ((List)value).toArray();
}
if (value.getClass().isArray()) {
StringBuilder sb = new StringBuilder();
sb.append("[");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment