You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/02/25 08:48:19 UTC
[dubbo] branch master updated: fix bug: avoid npe when encode
request (#6961)
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 db433f9 fix bug: avoid npe when encode request (#6961)
db433f9 is described below
commit db433f9f033381c8ab5cda4198f2be20e0cd7917
Author: wiki <dr...@outlook.com>
AuthorDate: Thu Feb 25 16:48:05 2021 +0800
fix bug: avoid npe when encode request (#6961)
---
.../main/java/org/apache/dubbo/remoting/exchange/Request.java | 10 ++++++++++
.../apache/dubbo/remoting/exchange/support/DefaultFuture.java | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java
index 2e08e8f..6eea6b0 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/Request.java
@@ -127,6 +127,16 @@ public class Request {
}
}
+ public Request copy() {
+ Request copy = new Request(mId);
+ copy.mVersion = this.mVersion;
+ copy.mTwoWay = this.mTwoWay;
+ copy.mEvent = this.mEvent;
+ copy.mBroken = this.mBroken;
+ copy.mData = this.mData;
+ return copy;
+ }
+
@Override
public String toString() {
return "Request [id=" + mId + ", version=" + mVersion + ", twoway=" + mTwoWay + ", event=" + mEvent
diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java
index e5acf6d..beddc2d 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java
@@ -261,7 +261,7 @@ public class DefaultFuture extends CompletableFuture<Object> {
}
private Request getRequestWithoutData() {
- Request newRequest = request;
+ Request newRequest = request.copy();
newRequest.setData(null);
return newRequest;
}