diff --git a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataInfo.java b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataInfo.java index 17012a7f0b5..6849b87d55b 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataInfo.java +++ b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataInfo.java @@ -221,6 +221,9 @@ public static class ServiceInfo implements Serializable { private transient URL url; + private final static String[] KEYS_TO_REMOVE = {MONITOR_KEY, BIND_IP_KEY, BIND_PORT_KEY, QOS_ENABLE, + QOS_HOST, QOS_PORT, ACCEPT_FOREIGN_IP, VALIDATION_KEY, INTERFACES, PID_KEY, TIMESTAMP_KEY}; + public ServiceInfo() { } @@ -231,11 +234,10 @@ public ServiceInfo(URL url) { Map params = new HashMap<>(); List filters = loader.getActivateExtension(url, "params-filter"); if (filters.size() == 0) { - params.putAll( - url.removeParameters( - MONITOR_KEY, BIND_IP_KEY, BIND_PORT_KEY, QOS_ENABLE, - QOS_HOST, QOS_PORT, ACCEPT_FOREIGN_IP, VALIDATION_KEY, INTERFACES, PID_KEY, TIMESTAMP_KEY) - .getParameters()); + params.putAll(url.getParameters()); + for (String key : KEYS_TO_REMOVE) { + params.remove(key); + } } for (MetadataParamsFilter filter : filters) { String[] paramsIncluded = filter.serviceParamsIncluded();