Fixed issues when retrieving data from external sources

This commit is contained in:
George Kalampokis 2020-09-11 14:29:12 +03:00
parent b66fe982f5
commit 88ea24d367
1 changed files with 13 additions and 7 deletions

View File

@ -297,7 +297,11 @@ public class RemoteFetcher {
} }
} }
} else { } else {
mapToMap(id, (Map<String, String>)obj, item, i == 1); if (obj instanceof Map) {
mapToMap(id, (Map<String, String>) obj, item, i == 1);
} else if (obj != null){
item.put(id, obj.toString());
}
} }
} }
} }
@ -502,14 +506,16 @@ public class RemoteFetcher {
} }
private void mapToMap(String key, Map<String, String> source, Map<String, String> destination, boolean isTitle) { private void mapToMap(String key, Map<String, String> source, Map<String, String> destination, boolean isTitle) {
String content = source.get("content"); if (source != null) {
if (isTitle) { String content = source.get("content");
String classId = source.get("classid"); if (isTitle) {
if (classId.equals("main title")) { String classId = source.get("classid");
if (classId.equals("main title")) {
destination.put(key, content);
}
} else {
destination.put(key, content); destination.put(key, content);
} }
} else {
destination.put(key, content);
} }
} }
} }