Skip to content

Commit e3ec28b

Browse files
authored
Allow only non null values to flow to influxDB
InfluxDB does not allow null values for tags or fields. When null is propagated to influx, it throws an exception and the data is lost. To avoid this populate the Builder with only non null values.
1 parent ffa2fe2 commit e3ec28b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/influxdb/dto/Point.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,13 @@ private void addFieldByAttribute(final Object pojo, final Field field, final Col
276276
}
277277

278278
if (column.tag()) {
279-
this.tags.put(fieldName, (String) fieldValue);
279+
if(fieldValue != null) {
280+
this.tags.put(fieldName, (String) fieldValue);
281+
}
280282
} else {
281-
this.fields.put(fieldName, fieldValue);
283+
if(fieldValue != null) {
284+
this.fields.put(fieldName, fieldValue);
285+
}
282286
}
283287

284288
} catch (IllegalArgumentException | IllegalAccessException e) {

0 commit comments

Comments
 (0)