Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.10.0
-
None
-
Novice
Description
ZipkinServerResponseAdapter#onResponse possible NullPointerException
ISSUE:
if (exchange.getException() != null) { String message = exchange.getException().getMessage(); span.tag("camel.server.exchange.failure", message); }
span is instance of SpanCustomizer.
SpanCustomizer has method:
// Params: key – Name used to lookup spans, such as "your_app.version". // value – String value, cannot be null. SpanCustomizer tag(String key, String value);
SpanCustomizer#tag second parameter cannot be null.
exchange.getException() is instance of Throwable
Throwable#getMethod documentation:
//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; }
Throwable.getMessage() may be null
FIX:
Second null check of getMessage method should fix this bug
if (exchange.getException() != null && exchange.getException().getMessage() != null) { String message = exchange.getException().getMessage(); span.tag("camel.server.exchange.failure", message); }