lovepoem closed pull request #2509: code promote: move constant field to
Constants class
URL: https://github.com/apache/incubator-dubbo/pull/2509
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
index 9506930690..4d6e7585cf 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
@@ -362,6 +362,8 @@
public final static String PATH_SEPARATOR = "/";
+ public final static String PROTOCOL_SEPARATOR = "://";
+
public static final String REGISTRY_SEPARATOR = "|";
public static final Pattern REGISTRY_SPLIT_PATTERN = Pattern
diff --git
a/dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistry.java
b/dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistry.java
index 86465b6f4b..43426c7b9f 100644
---
a/dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistry.java
+++
b/dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistry.java
@@ -278,7 +278,7 @@ private String toUrlPath(URL url) {
if (providers != null && !providers.isEmpty()) {
for (String provider : providers) {
provider = URL.decode(provider);
- if (provider.contains("://")) {
+ if (provider.contains(Constants.PROTOCOL_SEPARATOR)) {
URL url = URL.valueOf(provider);
if (UrlUtils.isMatch(consumer, url)) {
urls.add(url);
@@ -292,7 +292,7 @@ private String toUrlPath(URL url) {
private List<URL> toUrlsWithEmpty(URL consumer, String path, List<String>
providers) {
List<URL> urls = toUrlsWithoutEmpty(consumer, providers);
if (urls == null || urls.isEmpty()) {
- int i = path.lastIndexOf('/');
+ int i = path.lastIndexOf(Constants.PATH_SEPARATOR);
String category = i < 0 ? path : path.substring(i + 1);
URL empty =
consumer.setProtocol(Constants.EMPTY_PROTOCOL).addParameter(Constants.CATEGORY_KEY,
category);
urls.add(empty);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]