You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by me...@apache.org on 2019/06/25 01:39:41 UTC
[dubbo] branch 2.6.x updated: [No issue] Fix: @Method default value
will be set to the field of MethodConfig (#3642)
This is an automated email from the ASF dual-hosted git repository.
mercyblitz pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/2.6.x by this push:
new ffce958 [No issue] Fix: @Method default value will be set to the field of MethodConfig (#3642)
ffce958 is described below
commit ffce958ee037bf49e13f7f6cfce9ee212e3f2a8b
Author: cvictory <sh...@gmail.com>
AuthorDate: Tue Jun 25 09:39:12 2019 +0800
[No issue] Fix: @Method default value will be set to the field of MethodConfig (#3642)
* fix #2842. fix duplicate SPI definitions
* fix @Method set empty string into field
---
.../main/java/com/alibaba/dubbo/config/MethodConfig.java | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MethodConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MethodConfig.java
index 7fa7140..391e42c 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MethodConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MethodConfig.java
@@ -17,6 +17,7 @@
package com.alibaba.dubbo.config;
import com.alibaba.dubbo.common.Constants;
+import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.config.annotation.Method;
import com.alibaba.dubbo.config.support.Parameter;
@@ -83,9 +84,17 @@ public class MethodConfig extends AbstractMethodConfig {
public MethodConfig(Method method) {
appendAnnotation(Method.class, method);
this.setReturn(method.isReturn());
- this.setOninvoke(method.oninvoke());
- this.setOnreturn(method.onreturn());
- this.setOnthrow(method.onthrow());
+
+ if(StringUtils.isNotEmpty(method.oninvoke())){
+ this.setOninvoke(method.oninvoke());
+ }
+ if(StringUtils.isNotEmpty(method.onreturn())){
+ this.setOnreturn(method.onreturn());
+ }
+ if(StringUtils.isNotEmpty(method.onthrow())){
+ this.setOnthrow(method.onthrow());
+ }
+
if (method.arguments() != null && method.arguments().length != 0) {
List<ArgumentConfig> argumentConfigs = new ArrayList<ArgumentConfig>(method.arguments().length);
this.setArguments(argumentConfigs);