From c12076f4eaee97525f9661422c649a8e19d1c49c Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 5 Jun 2024 08:40:08 +0200 Subject: [PATCH] insert null attribute as is in feature table --- .../iot/cygnus/sinks/NGSIArcgisFeatureTableSink.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 df3eed7ea..e933e39a2 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 @@ -631,16 +631,15 @@ protected void jsonElementToFeatureAttr(String attrName, String attrType, JsonEl // Try to insert as Double feature.addAttribute(attrName, Double.parseDouble(attrValue.toString())); } catch (NumberFormatException e3) { - // If all fails, insert as is LOGGER.warn( "[NGSIArcgisAggregator] Unquoted String attribute: " + attrName + ":" + attrValue); - try { - feature.addAttribute(attrName, attrValue); - - } catch (Exception e) { - // If all fails, insert as String + // If all fails, insert as String + if (attrValue != null) { String strValue = URLDecoder.decode(attrValue.toString()); feature.addAttribute(attrName, strValue); + } else { + // Insert null as is + feature.addAttribute(attrName, attrValue); } }