* Fix issue #5795 

Fix the issue: nutz plugin throw NPE at afterMethod, cause traceid keep unchange for the thread

* fix the style and modify the CHANGES.md

Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
Co-authored-by: simonlei <simonlei@tencent.com>
Co-authored-by: kezhenxu94 <kezhenxu94@apache.org>
This commit is contained in:
simonlei 2020-11-06 07:54:58 +08:00 committed by GitHub
parent c32caab6e0
commit 901e8d8423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -15,6 +15,7 @@ Release Notes.
* Make the okhttp3 plugin to support Java 14
* Polish tracing context related codes.
* Add the plugin for async-http-client 2.x
* Fix NPE in the nutz plugin.
#### OAP-Backend
* Add the `@SuperDataset` annotation for BrowserErrorLog.

View File

@ -63,11 +63,12 @@ public class SenderSendInterceptor implements InstanceMethodsAroundInterceptor {
public Object afterMethod(final EnhancedInstance objInst, final Method method, final Object[] allArguments,
final Class<?>[] argumentsTypes, Object ret) throws Throwable {
Response response = (Response) ret;
int statusCode = response.getStatus();
AbstractSpan span = ContextManager.activeSpan();
if (statusCode >= 400) {
if (response == null || response.getStatus() >= 400) {
span.errorOccurred();
Tags.STATUS_CODE.set(span, Integer.toString(statusCode));
if (response != null)
Tags.STATUS_CODE.set(span, Integer.toString(response.getStatus()));
}
ContextManager.stopSpan();
return ret;