Skip to content

Commit

Permalink
chore: adds check for null values array in JSON desrializer
Browse files Browse the repository at this point in the history
  • Loading branch information
karel-rehor committed Jul 12, 2024
1 parent 49450ec commit f3582c6
Showing 1 changed file with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,26 +335,28 @@ public InfluxQLQueryResult.Result deserialize(
serie = new InfluxQLQueryResult.Series(name, columns);
}
JsonArray jvals = sobj.get("values").getAsJsonArray();
for (JsonElement jval : jvals) {
List<Object> values = new ArrayList<>();
JsonArray jae = jval.getAsJsonArray();
int index = 0;
for (JsonElement je : jae) {
List<String> columnKeys = new ArrayList<>(serie.getColumns().keySet());
if (extractor != null) {
String stringVal = je.getAsString();
Object ov = extractor.extractValue(
columnKeys.get(index),
stringVal,
id,
serie.getName());
values.add(ov);
} else {
values.add(je.getAsString());
if (jvals != null) {
for (JsonElement jval : jvals) {
List<Object> values = new ArrayList<>();
JsonArray jae = jval.getAsJsonArray();
int index = 0;
for (JsonElement je : jae) {
List<String> columnKeys = new ArrayList<>(serie.getColumns().keySet());
if (extractor != null) {
String stringVal = je.getAsString();
Object ov = extractor.extractValue(
columnKeys.get(index),
stringVal,
id,
serie.getName());
values.add(ov);
} else {
values.add(je.getAsString());
}
index++;
}
index++;
serie.addRecord(serie.new Record(values.toArray()));
}
serie.addRecord(serie.new Record(values.toArray()));
}
series.add(serie);
}
Expand Down

0 comments on commit f3582c6

Please sign in to comment.