Skip to content

Commit

Permalink
[collector] bugfix: Fixed expression:(A | B), A and B are null, print…
Browse files Browse the repository at this point in the history
… the error log (#387)
  • Loading branch information
Ceilzcx authored and tomsun28 committed Oct 25, 2022
1 parent d86de8b commit 2a34c5a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,12 @@ private void calculateFields(Metrics metrics, CollectRep.MetricsData.Builder col
}
}
try {
Object objValue = expression.execute(fieldValueMap);
// A | B的表达式, A和B都的value都为null, 防止打印异常
List<Object> valueList = fieldValueMap.values().stream().filter(Objects::nonNull).collect(Collectors.toList());
Object objValue = null;
if (!valueList.isEmpty()) {
objValue = expression.execute(fieldValueMap);
}
if (objValue != null) {
value = String.valueOf(objValue);
}
Expand Down

0 comments on commit 2a34c5a

Please sign in to comment.