Skip to content

Commit

Permalink
Make serviceName check null-safe
Browse files Browse the repository at this point in the history
Span object stores `localEndpoint.serviceName` empty string as null so `.isEmpty()` throws NullPointerException.
  • Loading branch information
z-oo authored Sep 13, 2019
1 parent 4688ae7 commit 48777fb
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ Attributes extract(Span zipkinSpan) {
}
}

if (zipkinSpan.localEndpoint() != null && !zipkinSpan.localEndpoint().serviceName().isEmpty()) {
if (zipkinSpan.localEndpoint() != null &&
zipkinSpan.localEndpoint().serviceName() != null &&
!zipkinSpan.localEndpoint().serviceName().isEmpty()) {
attributes.putAttributeMap(
kComponentLabelKey, toAttributeValue(zipkinSpan.localEndpoint().serviceName()));
}
Expand Down

0 comments on commit 48777fb

Please sign in to comment.