Skip to content

Commit

Permalink
Fixed the null pointer in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Camelia-Orcid committed Feb 11, 2025
1 parent 189347f commit f3a403a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,14 @@ private boolean loadData() {
country = StringUtils.isBlank(countryCode) ? null : Iso3166Country.fromValue(countryCode);
// for now storing just the first location
city = geoDetailsNode.get("name").isNull() ? null : geoDetailsNode.get("name").asText();
region = geoDetailsNode.get("country_subdivision_name").isNull() ? null : geoDetailsNode.get("country_subdivision_name").asText();
if(geoDetailsNode.get("country_subdivision_name") != null ) {
region = geoDetailsNode.get("country_subdivision_name").isNull() ? null : geoDetailsNode.get("country_subdivision_name").asText();
}
if (country != null) {
break;
}
}


}
locationsJson = locationsNode.toString();
Expand Down Expand Up @@ -256,6 +259,7 @@ private OrgDisambiguatedEntity processInstitute(String sourceId, String name, Is

String region, String url, String orgType, String locationsJson, String namesJson) {
OrgDisambiguatedEntity existingBySourceId = orgDisambiguatedDao.findBySourceIdAndSourceType(sourceId, OrgDisambiguatedSourceType.ROR.name());

if (existingBySourceId != null) {
boolean entityChanged = entityChanged(existingBySourceId, name, country.value(), city, region, url, orgType, locationsJson, namesJson);
if (entityChanged || indexAllEnabled) {
Expand Down

0 comments on commit f3a403a

Please sign in to comment.