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

Closed
wants to merge 6 commits into from
Closed
Changes from 2 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.Objects;
harshithasudhakar marked this conversation as resolved.
Show resolved Hide resolved

import io.cloudevents.CloudEvent;
import io.netty.channel.ChannelHandlerContext;
Expand Down Expand Up @@ -120,7 +121,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 +141,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