influxdata / influxdata/influxdb-client-java
InfluxQLQueryApiImpl cannot cast JsonNull
@NguyenHoangSon96 đang làm issue này rồi.
Từ ngày 3/2/2025.
- Ngôn ngữ chính
- Java
- Star
- 477
- Fork
- 129
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.