Skip to content

Commit

Permalink
use equals with getAsString
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed May 11, 2021
1 parent 0185c6b commit e17130e
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,19 @@ private void persistAggregation(NGSIGenericAggregator aggregator) throws CygnusP
JsonElement attType;
if (rowAttrPersistence) {
attType = aggregator.getAggregation().get(NGSIConstants.ATTR_TYPE).get(i);
if ( (attType != null) &&
(attType.toString().contains("ISO8601") ||
attType.toString().contains("DateTime")) ) {
if ( (attType != null &&
attType.isJsonPrimitive()) &&
(attType.getAsString().equals("ISO8601") ||
attType.getAsString().equals("DateTime")) ) {
basicDBObject = castDate(NGSIConstants.ATTR_VALUE, basicDBObject);
}
} else {
for (String key : basicDBObject.keySet()) {
attType = aggregator.getAggregation().get(key + NGSIConstants.AUTOGENERATED_ATTR_TYPE).get(i);
if ( (attType != null) &&
(attType.toString().contains("ISO8601") ||
attType.toString().contains("DateTime")) ) {
if ( (attType != null &&
attType.isJsonPrimitive()) &&
(attType.getAsString().equals("ISO8601") ||
attType.getAsString().equals("DateTime")) ) {
basicDBObject = castDate(key, basicDBObject);
}
}
Expand Down

0 comments on commit e17130e

Please sign in to comment.