Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #3402]"getExtension()" can return null.[Trace] #3632

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update Trace.java
Included "Object.requireNonNull()"
  • Loading branch information
harshithasudhakar committed Apr 5, 2023
commit da88de93dfa07af7d42b1ea607292af27769a2d9
Original file line number Diff line number Diff line change
Expand Up @@ -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());
harshithasudhakar marked this conversation as resolved.
Show resolved Hide resolved
harshithasudhakar marked this conversation as resolved.
Show resolved Hide resolved
}
return span;
}
Expand All @@ -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());
harshithasudhakar marked this conversation as resolved.
Show resolved Hide resolved
harshithasudhakar marked this conversation as resolved.
Show resolved Hide resolved
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you see there is no problem with the original code here. The other one is in the same situation.
In conclusion, this issue should not be posted. So let's wait the maintainer to make the final decision.

return span;
}
Expand Down