You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by vi...@apache.org on 2019/09/24 12:09:53 UTC

[dubbo] branch 2.7.4-release updated: add back try-catch clause deleted in https://github.com/apache/dubbo/pull/4899. (#5110)

This is an automated email from the ASF dual-hosted git repository.

victory pushed a commit to branch 2.7.4-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/2.7.4-release by this push:
     new 547170d  add back try-catch clause deleted in https://github.com/apache/dubbo/pull/4899. (#5110)
547170d is described below

commit 547170d1e8518f57c02c64ae4c72345690b5882d
Author: ken.lj <ke...@gmail.com>
AuthorDate: Tue Sep 24 20:09:42 2019 +0800

    add back try-catch clause deleted in https://github.com/apache/dubbo/pull/4899. (#5110)
---
 .../main/java/org/apache/dubbo/config/AbstractConfig.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractConfig.java
index 40c2f75..42d89b8 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractConfig.java
@@ -603,10 +603,16 @@ public abstract class AbstractConfig implements Serializable {
             Method[] methods = getClass().getMethods();
             for (Method method : methods) {
                 if (MethodUtils.isSetter(method)) {
-                    String value = StringUtils.trim(compositeConfiguration.getString(extractPropertyName(getClass(), method)));
-                    // isTypeMatch() is called to avoid duplicate and incorrect update, for example, we have two 'setGeneric' methods in ReferenceConfig.
-                    if (StringUtils.isNotEmpty(value) && ClassUtils.isTypeMatch(method.getParameterTypes()[0], value)) {
-                        method.invoke(this, ClassUtils.convertPrimitive(method.getParameterTypes()[0], value));
+                    try {
+                        String value = StringUtils.trim(compositeConfiguration.getString(extractPropertyName(getClass(), method)));
+                        // isTypeMatch() is called to avoid duplicate and incorrect update, for example, we have two 'setGeneric' methods in ReferenceConfig.
+                        if (StringUtils.isNotEmpty(value) && ClassUtils.isTypeMatch(method.getParameterTypes()[0], value)) {
+                            method.invoke(this, ClassUtils.convertPrimitive(method.getParameterTypes()[0], value));
+                        }
+                    } catch (NoSuchMethodException e) {
+                        logger.info("Failed to override the property " + method.getName() + " in " +
+                                this.getClass().getSimpleName() +
+                                ", please make sure every property has getter/setter method provided.");
                     }
                 } else if (isParametersSetter(method)) {
                     String value = StringUtils.trim(compositeConfiguration.getString(extractPropertyName(getClass(), method)));