Skip to content

Commit

Permalink
code promote: move constant field to Constants class (apache#2509)
Browse files Browse the repository at this point in the history
  • Loading branch information
channgli authored and lovepoem committed Sep 17, 2018
1 parent 917756e commit bcc3e74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ public class Constants {

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
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);
Expand All @@ -292,7 +292,7 @@ private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
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);
Expand Down

0 comments on commit bcc3e74

Please sign in to comment.