From 9e0145a8040e56f5c2badb8b5a83f38708b38c25 Mon Sep 17 00:00:00 2001 From: Andy Kwok Date: Mon, 2 Dec 2024 11:39:30 -0800 Subject: [PATCH] Code comments Signed-off-by: Andy Kwok --- CHANGELOG.md | 2 +- .../action/IpEnrichmentTransportAction.java | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e16dca8c..b2ef4a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ See the [CONTRIBUTING guide](./CONTRIBUTING.md#Changelog) for instructions on ho ## [Unreleased 2.x](https://github.com/opensearch-project/geospatial/compare/2.17...2.x) ### Features -- Introduce new Java artifact geospatial-client to facilitate cross plugin communication. +- Introduce new Java artifact geospatial-client to facilitate cross plugin communication. ([#700](https://github.com/opensearch-project/geospatial/pull/700)) ### Enhancements ### Bug Fixes ### Infrastructure diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/IpEnrichmentTransportAction.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/IpEnrichmentTransportAction.java index 3719fb93..5932835c 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/IpEnrichmentTransportAction.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/IpEnrichmentTransportAction.java @@ -53,15 +53,10 @@ public IpEnrichmentTransportAction(TransportService transportService, ActionFilt protected void doExecute(Task task, ActionRequest request, ActionListener listener) { IpEnrichmentRequest enrichmentRequest = IpEnrichmentRequest.fromActionRequest(request); String ipString = enrichmentRequest.getIpString(); - if (enrichmentRequest.getDatasourceName() == null) { - log.error("No data source available, IpEnrichmentTransportAction aborted."); - listener.onFailure(new IllegalArgumentException()); - } else { - String dataSourceName = enrichmentRequest.getDatasourceName(); - String indexName = ip2GeoCachedDao.getIndexName(dataSourceName); - Map geoLocationData = ip2GeoCachedDao.getGeoData(indexName, ipString); - log.debug("GeoSpatial IP lookup on IP: [{}], and result [{}]", ipString, geoLocationData); - listener.onResponse(new IpEnrichmentResponse(geoLocationData)); - } + String dataSourceName = enrichmentRequest.getDatasourceName(); + String indexName = ip2GeoCachedDao.getIndexName(dataSourceName); + Map geoLocationData = ip2GeoCachedDao.getGeoData(indexName, ipString); + log.debug("GeoSpatial IP lookup on IP: [{}], and result [{}]", ipString, geoLocationData); + listener.onResponse(new IpEnrichmentResponse(geoLocationData)); } }