`BatchPoints.Builder` not reusable
还没有人认领这个 Issue。
评估
调研方向
从 src/main/java/org/influxdb/dto/BatchPoints.java 开始,重点查看 BatchPoints.Builder.build() 以及 156-174 行附近引用的 points 集合。使用报告中的两次构建示例重现该问题;当分别构建的 BatchPoints 实例不再共享可变的 point 状态时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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
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
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.
- 主要语言
- Java
- 星标
- 1.2k
- 派生
- 468
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
influxdata/influxdb-java 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 38/100
influxdata/influxdb-java#1012 ·
-
难度 5/5 一周以上 新手友好度 30/100
influxdata/influxdb-java#1006 · 1 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 25/100
influxdata/influxdb-java#1005 · 3 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
influxdata/influxdb-java#999 ·
-
难度 4/5 3-5 天 新手友好度 35/100
influxdata/influxdb-java#970 ·
查看 influxdata/influxdb-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
quelea-projection/Quelea#711 ·
-
bug pdd
难度 2/5 1 小时以内 新手友好度 67/100
objectionary/eo#9450 ·
维护者通常 1 天内回复
-
[EC2] DescribeAvailabilityZones should return real AWS error for unknown zone name可能已有人在做 @omatheusmesmo 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
area: core good first issue type: enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
ShaftHQ/SHAFT_ENGINE#6909 ·
维护者通常 1 天内回复