fix npe when has null value tag field in pojo#598
fix npe when has null value tag field in pojo#598flashmouse wants to merge 1 commit intoinfluxdata:masterinfluxdata/influxdb-java:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #598 +/- ##
============================================
- Coverage 88.19% 88.16% -0.04%
Complexity 709 709
============================================
Files 69 69
Lines 2449 2450 +1
Branches 252 253 +1
============================================
Hits 2160 2160
Misses 204 204
- Partials 85 86 +1
Continue to review full report at Codecov.
|
|
|
||
| if (column.tag()) { | ||
| this.tags.put(fieldName, (String) fieldValue); | ||
| if (fieldValue != null && !((String) fieldValue).isEmpty()) { |
There was a problem hiding this comment.
I understand the null check, but why not adding if empty, that might be on pupose ?
There was a problem hiding this comment.
sry I dont know what you mean exactly,can you give some code or example...
There was a problem hiding this comment.
the old behavior just added the value of the field, now it is only added if not empty ?? What is wrong with an empty value, this is a API breakage.
There was a problem hiding this comment.
influx tag must be a string key and string value pair.if some field has column annotation :
- This filed not a String value,I think it's just incorrect usage
- This filed is a String value, but user havn't set or just give it "",i think we just need not to set this tag in Point.
if this field is an empty String,influxdb-java will also throw exception:
unable to parse 'example,tag1= value1=123i 1559035795995000000': missing tag value
There was a problem hiding this comment.
tag.getValue().replace("", "\\ ");
seems could resolved insert empty tag value.
There was a problem hiding this comment.
hi @majst01 tell me if you have any idea, my application will use in production soon, i don't want to maintain another branch
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #598 +/- ##
============================================
- Coverage 88.19% 88.16% -0.04%
Complexity 709 709
============================================
Files 69 69
Lines 2449 2450 +1
Branches 252 253 +1
============================================
Hits 2160 2160
Misses 204 204
- Partials 85 86 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
use addFieldsFromPOJO method build point will cause npe when some tag field hasn't set any value.