diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 20e4f8fd8..8e9eb07ae 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ - [cygnus-arcgis] Insert null attribute as is in feature table (#2376) +- [cygnus-arcgis] force null geometry when invalid geo:json format or type is found instead of Point(0,0) (#2379) diff --git a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/model/Feature.java b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/model/Feature.java index 44990d768..8e35c0cb6 100644 --- a/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/model/Feature.java +++ b/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/arcgis/model/Feature.java @@ -312,7 +312,7 @@ public static Feature createInstanceFromJson(JsonObject json) throws ArcgisExcep geometry = Point.createInstanceFromJson(jsonGeometry); // TODO another //geometry types? } else { - geometry = new Point(0, 0); + geometry = null; } Map attributes = attToMap(json.get(ATTRIBUTES_TAG).getAsJsonObject()); return new Feature(geometry, attributes); diff --git a/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java b/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java index 162d6fb26..cf7702f1e 100644 --- a/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java +++ b/cygnus-ngsi/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java @@ -596,10 +596,12 @@ protected void jsonElementToFeatureAttr(String attrName, String attrType, JsonEl } else { LOGGER.warn("Invalid geo:json type, only points allowed: " + location.toString()); + feature.setGeometry(null); } } catch (Exception e) { LOGGER.error("Invalid geo:json format, (sikipped): " + attrValue.toString() + " - Error: " + e.getMessage()); + feature.setGeometry(null); } break; case NGSI_BOOLEAN_DATATYPE: