Make remote fetcher's value normalization more type safe

This commit is contained in:
George Kalampokis 2022-01-24 11:29:06 +02:00
parent 8f56b1874b
commit f95a704787
1 changed files with 5 additions and 2 deletions

View File

@ -82,8 +82,11 @@ public class RemoteFetcherUtils {
if (jarr.get(0) instanceof String) { if (jarr.get(0) instanceof String) {
return jarr.get(0).toString(); return jarr.get(0).toString();
} else { } else {
return ((Map<String, String>)jarr.get(0)).get("content"); for (Object o : jarr) {
if ((o instanceof Map) && ((Map) o).containsKey("content")) {
return ((Map<String, String>) o).get("content");
}
}
} }
} else if (value instanceof Map) { } else if (value instanceof Map) {
return ((Map<String, String>)value).get("content"); return ((Map<String, String>)value).get("content");