influxdata / influxdata/influxdb-java
`BatchPoints.Builder` not reusable
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 1.2k
- Forks
- 469
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez dans src/main/java/org/influxdb/dto/BatchPoints.java, en particulier dans BatchPoints.Builder.build() et dans la collection de points référencée autour des lignes 156-174. Reproduisez le problème avec l’exemple de deux constructions du rapport ; c’est terminé lorsque les instances de BatchPoints construites séparément ne partagent plus d’état mutable des points.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- api
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100