提交 d5564045 编写于 作者: L lican 提交者: wu-sheng

fix NPE when has connection exception (#1253)

上级 e249e060
...@@ -100,12 +100,13 @@ public class RealCallInterceptor implements InstanceMethodsAroundInterceptor, In ...@@ -100,12 +100,13 @@ public class RealCallInterceptor implements InstanceMethodsAroundInterceptor, In
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Object ret) throws Throwable { Class<?>[] argumentsTypes, Object ret) throws Throwable {
Response response = (Response)ret; Response response = (Response)ret;
int statusCode = response.code(); if (response != null) {
int statusCode = response.code();
AbstractSpan span = ContextManager.activeSpan(); AbstractSpan span = ContextManager.activeSpan();
if (statusCode >= 400) { if (statusCode >= 400) {
span.errorOccurred(); span.errorOccurred();
Tags.STATUS_CODE.set(span, Integer.toString(statusCode)); Tags.STATUS_CODE.set(span, Integer.toString(statusCode));
}
} }
ContextManager.stopSpan(); ContextManager.stopSpan();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册