Source:
public WhoisResources geolocation( @Context final HttpServletRequest request, @QueryParam(value = "ipkey") final String ipkey) { List<Language> languages = null; Location location = null; if (ipkey == null) { throw new IllegalArgumentException("ipkey is required"); } try { final IpInterval interval = IpInterval.parse(ipkey); try { for (IpEntry ipEntry : Lists.reverse(lookupEntries(interval))) { final RpslObject rpslObject = lookup(ipEntry); final RpslObject orgObject = lookupOrg(rpslObject); if (location == null) { location = getLocation(rpslObject); if (location == null) { location = getLocation(orgObject); } } if (languages == null) { languages = getLanguages(rpslObject); if (languages == null) { languages = getLanguages(orgObject); } } if (location != null && languages != null) { break; } if (isStopStatus(rpslObject)) { break; } } } catch (EmptyResultDataAccessException ignored) { LOGGER.debug("EmptyResultDataAccessException ", ignored.getMessage()); } } catch (IllegalArgumentException e) { throw new WebApplicationException( Response.status(Response.Status.NOT_FOUND) .entity("No inetnum/inet6num resource has been found") .build()); } if (languages == null && location == null) { throw new WebApplicationException( Response.status(Response.Status.NOT_FOUND) .entity("No geolocation data was found for the given ipkey: " + ipkey) .build()); } final WhoisResources whoisResources = new WhoisResources(); whoisResources.setService(new Service(SERVICE_NAME)); whoisResources.setGeolocationAttributes(new GeolocationAttributes(location, languages)); whoisResources.setLink(Link.create(RestServiceHelper.getRequestURL(request).replaceFirst("/whois", ""))); whoisResources.includeTermsAndConditions(); return whoisResources; }

Target:
public WhoisResources geolocation( @Context final HttpServletRequest request, @QueryParam(value = "ipkey") final String ipkey) { List<Language> languages = null; Location location = null; if (ipkey == null) { throw new IllegalArgumentException("ipkey is required"); } try { final IpInterval interval = IpInterval.parse(ipkey); try { for (IpEntry ipEntry : Lists.reverse(lookupEntries(interval))) { final RpslObject rpslObject = lookup(ipEntry); final RpslObject orgObject = lookupOrg(rpslObject); if (location == null) { location = getLocation(rpslObject); if (location == null) { location = getLocation(orgObject); } } if (languages == null) { languages = getLanguages(rpslObject); if (languages == null) { languages = getLanguages(orgObject); } } if (location != null && languages != null) { break; } if (isStopStatus(rpslObject)) { break; } } } catch (EmptyResultDataAccessException ignored) { } } catch (IllegalArgumentException e) { throw new WebApplicationException( Response.status(Response.Status.NOT_FOUND) .entity("No inetnum/inet6num resource has been found") .build()); } if (languages == null && location == null) { throw new WebApplicationException( Response.status(Response.Status.NOT_FOUND) .entity("No geolocation data was found for the given ipkey: " + ipkey) .build()); } final WhoisResources whoisResources = new WhoisResources(); whoisResources.setService(new Service(SERVICE_NAME)); whoisResources.setGeolocationAttributes(new GeolocationAttributes(location, languages)); whoisResources.setLink(Link.create(RestServiceHelper.getRequestURL(request).replaceFirst("/whois", ""))); whoisResources.includeTermsAndConditions(); return whoisResources; }