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 { ...@@ -409,10 +409,10 @@ public class AccessionDetails {
for (Organization org : organizations) { for (Organization org : organizations) {
networks.add(org.getSlug()); networks.add(org.getSlug());
} }
if (institute == null) if (institute == null)
institute = new Institute(); institute = new Institute();
institute.setNetworks(networks); institute.setNetworks(networks);
} }
} }
...@@ -315,6 +315,8 @@ public class GenesysServiceImpl implements GenesysService, DatasetService { ...@@ -315,6 +315,8 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
@Override @Override
public AccessionDetails getAccessionDetails(long accessionId) { public AccessionDetails getAccessionDetails(long accessionId) {
Accession accession = getAccession(accessionId); Accession accession = getAccession(accessionId);
if (accession == null)
return null;
AccessionDetails ad = AccessionDetails.from(accession); AccessionDetails ad = AccessionDetails.from(accession);
ad.networks(organizationRepository.getOrganizations(accession.getInstitute())); ad.networks(organizationRepository.getOrganizations(accession.getInstitute()));
...@@ -335,6 +337,9 @@ public class GenesysServiceImpl implements GenesysService, DatasetService { ...@@ -335,6 +337,9 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
public Set<AccessionDetails> getAccessionDetails(Collection<Accession> accessions) { public Set<AccessionDetails> getAccessionDetails(Collection<Accession> accessions) {
Set<AccessionDetails> set = new HashSet<AccessionDetails>(accessions.size()); Set<AccessionDetails> set = new HashSet<AccessionDetails>(accessions.size());
for (Accession accn : accessions) { for (Accession accn : accessions) {
if (accn == null)
continue;
set.add(getAccessionDetails(accn.getId())); set.add(getAccessionDetails(accn.getId()));
} }
return set; return set;
......
...@@ -161,6 +161,9 @@ public class ElasticUpdaterAspect { ...@@ -161,6 +161,9 @@ public class ElasticUpdaterAspect {
// Delete all // Delete all
for (AccessionDetails accn : deletedAccessions) { for (AccessionDetails accn : deletedAccessions) {
if (accn == null)
continue;
elasticUpdater.remove(Accession.class, accn.getId()); 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