You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Pavol Zabka (Jira)" <ji...@apache.org> on 2021/06/11 13:42:00 UTC
[jira] [Created] (CAMEL-16715)
ZipkinServerResponseAdapter#onResponse possible NullPointerException
Pavol Zabka created CAMEL-16715:
-----------------------------------
Summary: ZipkinServerResponseAdapter#onResponse possible NullPointerException
Key: CAMEL-16715
URL: https://issues.apache.org/jira/browse/CAMEL-16715
Project: Camel
Issue Type: Bug
Components: camel-zipkin
Affects Versions: 3.10.0
Reporter: Pavol Zabka
h3. ZipkinServerResponseAdapter#onResponse possible NullPointerException
ISSUE:
{code:java}
if (exchange.getException() != null) {
String message = exchange.getException().getMessage();
span.tag("camel.server.exchange.failure", message);
}
{code}
_span_ is instance of _SpanCustomizer_.
_SpanCustomizer_ has method:
{code:java}
// Params: key – Name used to lookup spans, such as "your_app.version".
// value – String value, cannot be null.
SpanCustomizer tag(String key, String value);
{code}
_SpanCustomizer#tag_ second parameter cannot be null.
_exchange.getException()_ is instance of _Throwable_
_Throwable#getMethod_ documentation:
{code:java}
//Returns the detail message string of this throwable.
//Returns: the detail message string of this Throwable instance (which may be null).
public String getMessage() { return detailMessage; }
{code}
_Throwable.getMessage()_ may be null
FIX:
Second null check of _getMessage_ method should fix this bug
{code:java}
if (exchange.getException() != null && exchange.getException().getMessage() != null) {
String message = exchange.getException().getMessage();
span.tag("camel.server.exchange.failure", message);
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)