From c85f1d56733106e9fd519a715a8b95c86cdc8fec Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Tue, 4 Jun 2024 16:11:02 +0200 Subject: [PATCH] allow null attribute value for url --- .../cygnus/sinks/NGSIArcgisFeatureTableSink.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 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 0b7944d57..df3eed7ea 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,11 +631,18 @@ 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 String + // If all fails, insert as is LOGGER.warn( "[NGSIArcgisAggregator] Unquoted String attribute: " + attrName + ":" + attrValue); - String strValue = URLDecoder.decode(attrValue.toString()); - feature.addAttribute(attrName, strValue); + try { + feature.addAttribute(attrName, attrValue); + + } catch (Exception e) { + // If all fails, insert as String + String strValue = URLDecoder.decode(attrValue.toString()); + feature.addAttribute(attrName, strValue); + } + } } }