Skip to content

Commit

Permalink
Merge pull request #2377 from telefonicaid/task/null_attribute_value_url
Browse files Browse the repository at this point in the history
Insert null attribute as is in feature table
  • Loading branch information
fgalan authored Jun 5, 2024
2 parents af91598 + e4af776 commit 7de533e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@

- [cygnus-arcgis] Insert null attribute as is in feature table (#2376)
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,17 @@ 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
LOGGER.warn(
"[NGSIArcgisAggregator] Unquoted String attribute: " + attrName + ":" + attrValue);
String strValue = URLDecoder.decode(attrValue.toString());
feature.addAttribute(attrName, strValue);
// If all fails, insert as String, except if null
if (attrValue != null) {
String strValue = URLDecoder.decode(attrValue.toString());
feature.addAttribute(attrName, strValue);
} else {
// Insert null as is
feature.addAttribute(attrName, attrValue);
}

}
}
}
Expand Down

0 comments on commit 7de533e

Please sign in to comment.