1
0
Fork 0

avoid to NPE in case of null instances

This commit is contained in:
Claudio Atzori 2020-07-13 20:46:14 +02:00
parent 06def0c0cb
commit 8e97598eb4
1 changed files with 10 additions and 7 deletions

View File

@ -184,13 +184,16 @@ public class CreateRelatedEntitiesJob_phase1 {
re.setDateofacceptance(getValue(result.getDateofacceptance()));
re.setPublisher(getValue(result.getPublisher()));
re.setResulttype(result.getResulttype());
re
.setInstances(
result
.getInstance()
.stream()
.limit(ProvisionConstants.MAX_INSTANCES)
.collect(Collectors.toList()));
if (Objects.nonNull(result.getInstance())) {
re
.setInstances(
result
.getInstance()
.stream()
.filter(Objects::nonNull)
.limit(ProvisionConstants.MAX_INSTANCES)
.collect(Collectors.toList()));
}
// TODO still to be mapped
// re.setCodeRepositoryUrl(j.read("$.coderepositoryurl"));