You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2015/04/27 18:04:54 UTC
[09/10] incubator-nifi git commit: NIFI-549: Fixed NPE
NIFI-549: Fixed NPE
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/ba96e43a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/ba96e43a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/ba96e43a
Branch: refs/heads/develop
Commit: ba96e43a8e0fa682e9c803228d292969ffd0c686
Parents: 0759660
Author: Mark Payne <ma...@hotmail.com>
Authored: Mon Apr 27 12:01:36 2015 -0400
Committer: Mark Payne <ma...@hotmail.com>
Committed: Mon Apr 27 12:01:36 2015 -0400
----------------------------------------------------------------------
.../java/org/apache/nifi/processors/GeoEnrichIP.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ba96e43a/nifi/nifi-nar-bundles/nifi-geo-bundle/nifi-geo-processors/src/main/java/org/apache/nifi/processors/GeoEnrichIP.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-geo-bundle/nifi-geo-processors/src/main/java/org/apache/nifi/processors/GeoEnrichIP.java b/nifi/nifi-nar-bundles/nifi-geo-bundle/nifi-geo-processors/src/main/java/org/apache/nifi/processors/GeoEnrichIP.java
index be03243..1ecb221 100644
--- a/nifi/nifi-nar-bundles/nifi-geo-bundle/nifi-geo-processors/src/main/java/org/apache/nifi/processors/GeoEnrichIP.java
+++ b/nifi/nifi-nar-bundles/nifi-geo-bundle/nifi-geo-processors/src/main/java/org/apache/nifi/processors/GeoEnrichIP.java
@@ -189,8 +189,17 @@ public class GeoEnrichIP extends AbstractProcessor {
final Map<String, String> attrs = new HashMap<>();
attrs.put(new StringBuilder(ipAttributeName).append(".geo.lookup.micros").toString(), String.valueOf(stopWatch.getDuration(TimeUnit.MICROSECONDS)));
attrs.put(new StringBuilder(ipAttributeName).append(".geo.city").toString(), response.getCity().getName());
- attrs.put(new StringBuilder(ipAttributeName).append(".geo.latitude").toString(), response.getLocation().getLatitude().toString());
- attrs.put(new StringBuilder(ipAttributeName).append(".geo.longitude").toString(), response.getLocation().getLongitude().toString());
+
+ final Double latitude = response.getLocation().getLatitude();
+ if ( latitude != null ) {
+ attrs.put(new StringBuilder(ipAttributeName).append(".geo.latitude").toString(), latitude.toString());
+ }
+
+ final Double longitude = response.getLocation().getLongitude();
+ if ( longitude != null ) {
+ attrs.put(new StringBuilder(ipAttributeName).append(".geo.longitude").toString(), longitude.toString());
+ }
+
int i = 0;
for (final Subdivision subd : response.getSubdivisions()) {
attrs.put(new StringBuilder(ipAttributeName).append(".geo.subdivision.").append(i).toString(), subd.getName());