Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/1650#discussion_r113442378
--- Diff:
nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-processors/src/main/java/org/apache/nifi/processors/GeoEnrichIP.java
---
@@ -76,26 +76,36 @@ public void onTrigger(final ProcessContext context,
final ProcessSession session
final DatabaseReader dbReader = databaseReaderRef.get();
final String ipAttributeName =
context.getProperty(IP_ADDRESS_ATTRIBUTE).evaluateAttributeExpressions(flowFile).getValue();
final String ipAttributeValue =
flowFile.getAttribute(ipAttributeName);
- if (StringUtils.isEmpty(ipAttributeName)) { //TODO need to add
additional validation - should look like an IPv4 or IPv6 addr for instance
+
+ if (StringUtils.isEmpty(ipAttributeName)) {
session.transfer(flowFile, REL_NOT_FOUND);
- getLogger().warn("Unable to find ip address for {}", new
Object[]{flowFile});
+ getLogger().warn("FlowFile '{}' aatribute '{}' was empty.
Routing to failure",
+ new Object[]{flowFile,
IP_ADDRESS_ATTRIBUTE.getDisplayName()});
return;
}
+
InetAddress inetAddress = null;
CityResponse response = null;
try {
inetAddress = InetAddress.getByName(ipAttributeValue);
} catch (final IOException ioe) {
session.transfer(flowFile, REL_NOT_FOUND);
- getLogger().warn("Could not resolve {} to ip address for {}",
new Object[]{ipAttributeValue, flowFile}, ioe);
+ getLogger().warn("Could not resolve the IP for value '{}',
contained within the attribute '{}' in " +
+ "FlowFile '{}'. This is usually caused by
issue resolving the appropriate DNS record or " +
+ "providing the processor with an invalid IP
address ",
+ new
Object[]{IP_ADDRESS_ATTRIBUTE.getDisplayName(), ipAttributeValue, flowFile},
ioe);
--- End diff --
The first two objects are reversed, I can fix this on merge
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---