Open jpalus opened 1 year ago
There's nothing in BatchPoints.Builder javadoc that would warn against calling build() multiple times: https://github.com/influxdata/influxdb-java/blob/b1d1d8a2ed4430f6b6ac271362acab7b493be984/src/main/java/org/influxdb/dto/BatchPoints.java#L54-L57 https://github.com/influxdata/influxdb-java/blob/b1d1d8a2ed4430f6b6ac271362acab7b493be984/src/main/java/org/influxdb/dto/BatchPoints.java#L151-L156
BatchPoints.Builder
build()
and nothing in build() method itself that would cause ie exception: https://github.com/influxdata/influxdb-java/blob/b1d1d8a2ed4430f6b6ac271362acab7b493be984/src/main/java/org/influxdb/dto/BatchPoints.java#L156-L174
but creating multiple BatchPoints instances from BatchPoints.Builder is not actually safe since BatchPoints.Builder does not make defensive copy of this.points: https://github.com/influxdata/influxdb-java/blob/b1d1d8a2ed4430f6b6ac271362acab7b493be984/src/main/java/org/influxdb/dto/BatchPoints.java#L162
BatchPoints
this.points
so ie this code will fail:
BatchPoints bp1 = builder.build(); int size = bp1.getPoints().size(); bp1.point(point); BatchPoints bp2 = builder.build(); assertEquals(size, bp2.getPoints().size());
since bp1.point(point) modified collection builder refers to.
bp1.point(point)
builder
There's nothing in
BatchPoints.Builder
javadoc that would warn against callingbuild()
multiple times: https://github.com/influxdata/influxdb-java/blob/b1d1d8a2ed4430f6b6ac271362acab7b493be984/src/main/java/org/influxdb/dto/BatchPoints.java#L54-L57 https://github.com/influxdata/influxdb-java/blob/b1d1d8a2ed4430f6b6ac271362acab7b493be984/src/main/java/org/influxdb/dto/BatchPoints.java#L151-L156and nothing in
build()
method itself that would cause ie exception: https://github.com/influxdata/influxdb-java/blob/b1d1d8a2ed4430f6b6ac271362acab7b493be984/src/main/java/org/influxdb/dto/BatchPoints.java#L156-L174but creating multiple
BatchPoints
instances fromBatchPoints.Builder
is not actually safe sinceBatchPoints.Builder
does not make defensive copy ofthis.points
: https://github.com/influxdata/influxdb-java/blob/b1d1d8a2ed4430f6b6ac271362acab7b493be984/src/main/java/org/influxdb/dto/BatchPoints.java#L162so ie this code will fail:
since
bp1.point(point)
modified collectionbuilder
refers to.