Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix on branch master, consumer invoke timeout cause NPE. #8587

Merged
merged 2 commits into from Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -118,11 +118,13 @@ public Object decode(Channel channel, InputStream input) throws IOException {
public void decode() throws Exception {
if (!hasDecoded && channel != null && inputStream != null) {
try {
if (ConfigurationUtils.getSystemConfiguration().getBoolean(SERIALIZATION_SECURITY_CHECK_KEY, false)) {
Object serializationType_obj = invocation.get(SERIALIZATION_ID_KEY);
if (serializationType_obj != null) {
if ((byte) serializationType_obj != serializationType) {
throw new IOException("Unexpected serialization id:" + serializationType + " received from network, please check if the peer send the right id.");
if (invocation != null) {
if (ConfigurationUtils.getSystemConfiguration().getBoolean(SERIALIZATION_SECURITY_CHECK_KEY, false)) {
wangchengming666 marked this conversation as resolved.
Show resolved Hide resolved
wangchengming666 marked this conversation as resolved.
Show resolved Hide resolved
Object serializationTypeObj = invocation.get(SERIALIZATION_ID_KEY);
if (serializationTypeObj != null) {
if ((byte) serializationTypeObj != serializationType) {
throw new IOException("Unexpected serialization id:" + serializationType + " received from network, please check if the peer send the right id.");
}
}
}
}
Expand Down
Expand Up @@ -30,21 +30,21 @@
public class DubboCodecSupport {

public static Serialization getRequestSerialization(URL url, Invocation invocation) {
Object serializationType_obj = invocation.get(SERIALIZATION_ID_KEY);
if (serializationType_obj != null) {
return CodecSupport.getSerializationById((byte) serializationType_obj);
Object serializationTypeObj = invocation.get(SERIALIZATION_ID_KEY);
if (serializationTypeObj != null) {
return CodecSupport.getSerializationById((byte) serializationTypeObj);
}
return ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(
url.getParameter(org.apache.dubbo.remoting.Constants.SERIALIZATION_KEY, Constants.DEFAULT_REMOTING_SERIALIZATION));
}

public static Serialization getResponseSerialization(URL url, AppResponse appResponse) {
Object invocation_obj = appResponse.getAttribute(INVOCATION_KEY);
if (invocation_obj != null) {
Invocation invocation = (Invocation) invocation_obj;
Object serializationType_obj = invocation.get(SERIALIZATION_ID_KEY);
if (serializationType_obj != null) {
return CodecSupport.getSerializationById((byte) serializationType_obj);
Object invocationObj = appResponse.getAttribute(INVOCATION_KEY);
if (invocationObj != null) {
Invocation invocation = (Invocation) invocationObj;
Object serializationTypeObj = invocation.get(SERIALIZATION_ID_KEY);
if (serializationTypeObj != null) {
return CodecSupport.getSerializationById((byte) serializationTypeObj);
}
}
return ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(
Expand Down