1
0
Fork 0

replaced null value with a more safe empty string as return value

This commit is contained in:
Enrico Ottonello 2020-10-22 15:32:26 +02:00
parent c58db1c8ea
commit 1139d6568d
2 changed files with 8 additions and 2 deletions

View File

@ -166,7 +166,13 @@ public class PublicationToOaf implements Serializable {
// Adding source
final String source = getStringValue(rootElement, "sourceName");
if (StringUtils.isNotBlank(source)) {
publication.setSource(Arrays.asList(mapStringField(source, null)));
Field<String> sourceField = mapStringField(source, null);
if (sourceField==null) {
publication.setSource(null);
}
else {
publication.setSource(Arrays.asList(sourceField));
}
}
// Adding titles

View File

@ -20,7 +20,7 @@ public class DumpToActionsUtility {
public static String getStringValue(final JsonObject root, final String key) {
if (root.has(key) && !root.get(key).isJsonNull())
return root.get(key).getAsString();
return null;
return new String("");
}
public static List<String> getArrayValues(final JsonObject root, final String key) {