From 8878d732dd4d6e862712aeaa5cc46e7c06d28892 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Wed, 21 Jun 2017 15:02:23 -0400 Subject: [PATCH] NIFI-4103: Return an empty Optional if an IP address cannot be found Signed-off-by: Matt Burgess This closes #1933 --- .../java/org/apache/nifi/lookup/maxmind/IPLookupService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/maxmind/IPLookupService.java b/nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/maxmind/IPLookupService.java index 096f1a68f6..58c868feb3 100644 --- a/nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/maxmind/IPLookupService.java +++ b/nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/maxmind/IPLookupService.java @@ -338,6 +338,10 @@ public class IPLookupService extends AbstractControllerService implements Record anonymousIpRecord = null; } + if (geoRecord == null && ispRecord == null && domainName == null && connectionType == null && anonymousIpRecord == null) { + return Optional.empty(); + } + return Optional.ofNullable(createContainerRecord(geoRecord, ispRecord, domainName, connectionType, anonymousIpRecord)); }