`BatchPoints.Builder` not reusable
jpalus opened this issue · comments
There's nothing in BatchPoints.Builder
javadoc that would warn against calling build()
multiple times:
influxdb-java/src/main/java/org/influxdb/dto/BatchPoints.java
Lines 54 to 57 in b1d1d8a
influxdb-java/src/main/java/org/influxdb/dto/BatchPoints.java
Lines 151 to 156 in b1d1d8a
and nothing in build()
method itself that would cause ie exception:
influxdb-java/src/main/java/org/influxdb/dto/BatchPoints.java
Lines 156 to 174 in b1d1d8a
but creating multiple BatchPoints
instances from BatchPoints.Builder
is not actually safe since BatchPoints.Builder
does not make defensive copy of 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.