Commit d7d2952e authored by Matija Obreza's avatar Matija Obreza

Fixed missing NPE check and println to stderr

parent 454a710a
...@@ -56,8 +56,13 @@ public class GeoRegionServiceImpl implements GeoRegionService { ...@@ -56,8 +56,13 @@ public class GeoRegionServiceImpl implements GeoRegionService {
@Override @Override
public GeoRegion getRegion(Country country) { public GeoRegion getRegion(Country country) {
// NPE check
country.getId();
GeoRegion geoRegion = geoRegionRepository.findByCountry(country); GeoRegion geoRegion = geoRegionRepository.findByCountry(country);
geoRegion.getCountries().size(); if (geoRegion != null) {
geoRegion.getCountries().size();
}
return geoRegion; return geoRegion;
} }
......
...@@ -147,14 +147,14 @@ public class SelectionController extends BaseController { ...@@ -147,14 +147,14 @@ public class SelectionController extends BaseController {
final String[] splits = accessionIds.split("[,;\\t\\n]+"); final String[] splits = accessionIds.split("[,;\\t\\n]+");
for (final String s : splits) { for (final String s : splits) {
System.err.println(">> '" + s.trim() + "'"); // System.err.println(">> '" + s.trim() + "'");
try { try {
final Accession accession = genesysService.getAccession(instCode, s.trim()); final Accession accession = genesysService.getAccession(instCode, s.trim());
if (accession != null) { if (accession != null) {
System.err.println("\t" + accession.getId()); // System.err.println("\t" + accession.getId());
selectionBean.add(accession.getId()); selectionBean.add(accession.getId());
} else { } else {
System.err.println("\t NF='" + s + "'"); // System.err.println("\t NF='" + s + "'");
} }
} catch (NonUniqueAccessionException e) { } catch (NonUniqueAccessionException e) {
// Non-unique // Non-unique
......
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