This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 4c8a54e Fix on branch master, consumer invoke timeout cause NPE.
(#8587)
4c8a54e is described below
commit 4c8a54ecff4d1cb2a5a785eb5ebe215b680b4770
Author: Bazooka <[email protected]>
AuthorDate: Wed Aug 25 18:38:06 2021 +0800
Fix on branch master, consumer invoke timeout cause NPE. (#8587)
* Fix on branch master, consumer invoke timeout cause NPE.
* use Camel-Case rule
---
.../dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java | 12 +++++++-----
.../dubbo/rpc/protocol/dubbo/DubboCodecSupport.java | 18 +++++++++---------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
index 30ee3a0..100c6e5 100644
---
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
+++
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
@@ -118,11 +118,13 @@ public class DecodeableRpcResult extends AppResponse
implements Codec, Decodeabl
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)) {
+ 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.");
+ }
}
}
}
diff --git
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodecSupport.java
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodecSupport.java
index 2dbb312..500888f 100644
---
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodecSupport.java
+++
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodecSupport.java
@@ -30,21 +30,21 @@ import static
org.apache.dubbo.rpc.Constants.SERIALIZATION_ID_KEY;
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(