orcid-no-doi #43

Merged
claudio.atzori merged 45 commits from enrico.ottonello/dnet-hadoop:orcid-no-doi into master 2020-12-02 10:55:12 +01:00
2 changed files with 8 additions and 2 deletions
Showing only changes of commit 1139d6568d - Show all commits

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
Review

Is the caller expecting the null? Otherwise this would likely produce a NPE.

Is the caller expecting the `null`? Otherwise this would likely produce a NPE.
Review

yes, there is a check on null value

yes, there is a check on null value

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("");

Is the caller expecting the null? Otherwise this would likely produce a NPE.

Is the caller expecting the null? Otherwise this would likely produce a NPE.

replaced null value with a more safe empty string

replaced null value with a more safe empty string
}
public static List<String> getArrayValues(final JsonObject root, final String key) {