FIX: NPE when thrift field is nested (#6909)

* FIX: NPE when field is nested

* ADD: change.md

Co-authored-by: Yang Xin <yangxinbj@fenbi.com>
This commit is contained in:
Leon Yang 2021-05-07 13:59:06 +08:00 committed by GitHub
parent 004eef65ec
commit 0036ea674f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 17 deletions

View File

@ -23,6 +23,7 @@ Release Notes.
* Add an optional agent plugin to support mybatis. * Add an optional agent plugin to support mybatis.
* Add `spring-cloud-gateway-3.x` optional plugin. * Add `spring-cloud-gateway-3.x` optional plugin.
* Add `okhttp-4.x` plugin. * Add `okhttp-4.x` plugin.
* Fix NPE when thrift field is nested in plugin `thrift`
#### OAP-Backend #### OAP-Backend
* BugFix: filter invalid Envoy access logs whose socket address is empty. * BugFix: filter invalid Envoy access logs whose socket address is empty.

View File

@ -85,7 +85,13 @@ public class ServerInProtocolWrapper extends AbstractProtocolWrapper {
} }
return readFieldBegin(); return readFieldBegin();
} }
if (field.type == TType.STOP) {
return field;
}
@Override
public void readMessageEnd() throws TException {
super.readMessageEnd();
Boolean haveCreatedSpan = Boolean haveCreatedSpan =
(Boolean) ContextManager.getRuntimeContext().get(HAVE_CREATED_SPAN); (Boolean) ContextManager.getRuntimeContext().get(HAVE_CREATED_SPAN);
if (haveCreatedSpan != null && !haveCreatedSpan) { if (haveCreatedSpan != null && !haveCreatedSpan) {
@ -103,8 +109,6 @@ public class ServerInProtocolWrapper extends AbstractProtocolWrapper {
} }
} }
} }
return field;
}
private ContextCarrier createContextCarrier(Map<String, String> header) { private ContextCarrier createContextCarrier(Map<String, String> header) {
ContextCarrier carrier = new ContextCarrier(); ContextCarrier carrier = new ContextCarrier();