forked from D-Net/dnet-hadoop
[broker] prevent NPEs
This commit is contained in:
parent
04cb96001c
commit
0a58bc7ba7
|
@ -128,13 +128,22 @@ public class ConversionUtils {
|
||||||
|
|
||||||
protected static List<OaBrokerTypedValue> allResultPids(final Result result) {
|
protected static List<OaBrokerTypedValue> allResultPids(final Result result) {
|
||||||
final Map<String, StructuredProperty> map = new HashMap<>();
|
final Map<String, StructuredProperty> map = new HashMap<>();
|
||||||
|
|
||||||
|
if (result.getPid() != null) {
|
||||||
result.getPid().forEach(sp -> map.put(sp.getValue(), sp));
|
result.getPid().forEach(sp -> map.put(sp.getValue(), sp));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.getInstance() != null) {
|
||||||
result.getInstance().forEach(i -> {
|
result.getInstance().forEach(i -> {
|
||||||
|
if (i.getPid() != null) {
|
||||||
i.getPid().forEach(sp -> map.put(sp.getValue(), sp));
|
i.getPid().forEach(sp -> map.put(sp.getValue(), sp));
|
||||||
|
}
|
||||||
|
if (i.getAlternateIdentifier() != null) {
|
||||||
i.getAlternateIdentifier().forEach(sp -> map.put(sp.getValue(), sp));
|
i.getAlternateIdentifier().forEach(sp -> map.put(sp.getValue(), sp));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
final List<OaBrokerTypedValue> pids = mappedList(map.values(), ConversionUtils::oafPidToBrokerPid);
|
}
|
||||||
return pids;
|
return mappedList(map.values(), ConversionUtils::oafPidToBrokerPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String cleanOpenaireId(final String id) {
|
public static String cleanOpenaireId(final String id) {
|
||||||
|
|
Loading…
Reference in New Issue