gnodet-bot commented on code in PR #27908:
URL: https://github.com/apache/camel/pull/27908#discussion_r4285284568
##########
components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConsumer.java:
##########
@@ -131,6 +132,19 @@ private void handleValueUpdate(final String node, final
DataValue value) {
}
}
+ /**
+ * A null value with a Good status is the initial value at startup, which
omitNullValues hides. A null value with a
+ * Bad or Uncertain status carries the quality of the node and is
delivered.
+ */
+ private static boolean isNullValueWithGoodStatus(final DataValue value) {
+ if (value == null) {
+ return true;
+ }
+ final boolean nullValue = value.getValue() == null ||
value.getValue().getValue() == null;
+ final StatusCode status = value.getStatusCode();
+ return nullValue && (status == null || status.isGood());
Review Comment:
💡 **Nullability note:** Under Milo's `@NullMarked` contract on `DataValue`,
`getValue()` and `getStatusCode()` are contractually non-null (no `@Nullable`
on their return types). This means `value.getValue() == null` and `status ==
null` are technically dead code — `DataValue` is a `@NullMarked` record so the
compiler and static analysers treat these as always-false. The checks are
harmless as defensive programming, but a brief comment would help future
readers understand the intent:
```suggestion
// value.getValue() is non-null per @NullMarked (DataValue record);
guard kept for safety
final boolean nullValue = value.getValue() == null ||
value.getValue().getValue() == null;
final StatusCode status = value.getStatusCode(); // non-null per
@NullMarked contract
return nullValue && (status == null || status.isGood());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]