Skip to content

Commit

Permalink
[No issue] Fix: @method default value will be set to the field of Met…
Browse files Browse the repository at this point in the history
…hodConfig (#3642)

* fix #2842. fix duplicate SPI definitions

* fix @method set empty string into field
  • Loading branch information
cvictory authored and mercyblitz committed Jun 25, 2019
1 parent 6804236 commit ffce958
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -83,9 +84,17 @@ public MethodConfig() {
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);
Expand Down

0 comments on commit ffce958

Please sign in to comment.