influxdata / influxdata/influxdb-client-java
InfluxQLQueryApiImpl cannot cast JsonNull
@NguyenHoangSon96 ci sta già lavorando.
Dal 3/2/2025.
- Lingua principale
- Java
- Stelle
- 477
- Fork
- 129
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hi,
I'm trying to use `queryJSON` method of `InfluxQLQueryApi`.
If I have `null` values resulting from my query, the library fires an exception because of the cast forced to String.
As we can see from line 337 of the class:
```
JsonArray jvals = sobj.get("values").getAsJsonArray();
if (jvals != null) {
for(JsonElement jval : jvals) {
List values = new ArrayList();
JsonArray jae = jval.getAsJsonArray();
int index = 0;
for(JsonElement je : jae) {
List columnKeys = new ArrayList(serie.getColumns().keySet());
if (this.extractor != null) {
String stringVal = je.getAsString();
Object ov = this.extractor.extractValue((String)columnKeys.get(index), stringVal, id, serie.getName());
values.add(ov);
} else {
values.add(je.getAsString());
}
++index;
}
Objects.requireNonNull(serie);
serie.addRecord(new InfluxQLQueryResult.Series.Record(serie, values.toArray()));
}
}
```
When it gets the `null` value, the instruction `String stringVal = je.getAsString();` fires the exception.
Am I doing something wrong?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.