From feaa9cc073c5f6db36b98ae83fab96037ad82a82 Mon Sep 17 00:00:00 2001 From: cvictory Date: Tue, 12 Mar 2019 18:32:00 +0800 Subject: [PATCH] #2045 add empty check --- .../org/apache/dubbo/config/MethodConfig.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/MethodConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/MethodConfig.java index b52d7943914..84510418817 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/MethodConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/MethodConfig.java @@ -125,10 +125,29 @@ 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(!"".equals(method.oninvoke())){ + this.setOninvoke(method.oninvoke()); + } + if(!"".equals(method.onreturn())){ + this.setOnreturn(method.onreturn()); + } + if(!"".equals(method.onthrow())){ + this.setOnthrow(method.onthrow()); + } + //if "" of @Method, then should set to null +// if("".equals(this.loadbalance)){ +// this.setLoadbalance(null); +// } +// if("".equals(this.cache)){ +// this.setLoadbalance(null); +// } +// if("".equals(this.validation)){ +// this.setValidation(null); +// } + if (method.arguments() != null && method.arguments().length != 0) { List argumentConfigs = new ArrayList(method.arguments().length); this.setArguments(argumentConfigs);