Commit 6ae4581c authored by Matija Obreza's avatar Matija Obreza
Browse files

Handle AccessionDetails#from NPE

parent 4cbfcae0
......@@ -409,10 +409,10 @@ public class AccessionDetails {
for (Organization org : organizations) {
networks.add(org.getSlug());
}
if (institute == null)
institute = new Institute();
institute.setNetworks(networks);
}
}
......@@ -315,6 +315,8 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
@Override
public AccessionDetails getAccessionDetails(long accessionId) {
Accession accession = getAccession(accessionId);
if (accession == null)
return null;
AccessionDetails ad = AccessionDetails.from(accession);
ad.networks(organizationRepository.getOrganizations(accession.getInstitute()));
......@@ -335,6 +337,9 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
public Set<AccessionDetails> getAccessionDetails(Collection<Accession> accessions) {
Set<AccessionDetails> set = new HashSet<AccessionDetails>(accessions.size());
for (Accession accn : accessions) {
if (accn == null)
continue;
set.add(getAccessionDetails(accn.getId()));
}
return set;
......
......@@ -161,6 +161,9 @@ public class ElasticUpdaterAspect {
// Delete all
for (AccessionDetails accn : deletedAccessions) {
if (accn == null)
continue;
elasticUpdater.remove(Accession.class, accn.getId());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment