You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@eventmesh.apache.org by "xwm1992 (via GitHub)" <gi...@apache.org> on 2023/04/06 02:27:24 UTC

[GitHub] [eventmesh] xwm1992 commented on a diff in pull request #3632: [ISSUE #3402]"getExtension()" can return null.[Trace]

xwm1992 commented on code in PR #3632:
URL: https://github.com/apache/eventmesh/pull/3632#discussion_r1159222217


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/trace/Trace.java:
##########
@@ -140,7 +140,7 @@ public Span addTraceInfoToSpan(Span span, CloudEvent cloudEvent) {
         }
 
         for (String entry : cloudEvent.getExtensionNames()) {
-            span.setAttribute(entry, cloudEvent.getExtension(entry) == null ? "" : cloudEvent.getExtension(entry).toString());
+            span.setAttribute(entry, cloudEvent.getExtension(entry) == null ? "" : Object.requireNonNull(cloudEvent.getExtension(entry)).toString());

Review Comment:
   same as above



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/trace/Trace.java:
##########
@@ -120,7 +120,7 @@ public Span addTraceInfoToSpan(ChannelHandlerContext ctx, CloudEvent cloudEvent)
 
         //add trace info
         for (String entry : cloudEvent.getExtensionNames()) {
-            span.setAttribute(entry, cloudEvent.getExtension(entry) == null ? "" : cloudEvent.getExtension(entry).toString());
+            span.setAttribute(entry, cloudEvent.getExtension(entry) == null ? "" : Object.requireNonNull(cloudEvent.getExtension(entry)).toString());

Review Comment:
   this dependent on `java.util.Objects` please import, and change it to `Objects.requireNonNull`.



-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org