influxdata / influxdata/influxdb-client-java

InfluxQLQueryApiImpl cannot cast JsonNull

Đang mở
#808 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

@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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.