fix review
Signed-off-by: slievrly <slievrly@163.com>
This commit is contained in:
parent
e01a44702b
commit
f17f40e0af
@ -22,6 +22,7 @@ import com.alibaba.nacos.api.config.filter.IConfigFilterChain;
|
||||
import com.alibaba.nacos.api.config.filter.IConfigRequest;
|
||||
import com.alibaba.nacos.api.config.filter.IConfigResponse;
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
@ -72,8 +73,7 @@ public class ConfigFilterChainManager implements IConfigFilterChain {
|
||||
|
||||
@Override
|
||||
public void doFilter(final IConfigRequest request, final IConfigResponse response) throws NacosException {
|
||||
if (this.currentPosition == this.additionalFilters.size()) {
|
||||
} else {
|
||||
if (this.currentPosition != this.additionalFilters.size()) {
|
||||
this.currentPosition++;
|
||||
IConfigFilter nextFilter = this.additionalFilters.get(this.currentPosition - 1);
|
||||
nextFilter.doFilter(request, response, this);
|
||||
|
@ -15,21 +15,31 @@
|
||||
*/
|
||||
package com.alibaba.nacos.client.config.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.alibaba.nacos.api.PropertyKeyConst;
|
||||
import com.alibaba.nacos.api.SystemPropertyKeyConst;
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.alibaba.nacos.client.config.impl.EventDispatcher.ServerlistChangeEvent;
|
||||
import com.alibaba.nacos.client.config.impl.HttpSimpleClient.HttpResult;
|
||||
import com.alibaba.nacos.client.config.utils.IOUtils;
|
||||
import com.alibaba.nacos.client.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import com.alibaba.nacos.client.utils.EnvUtil;
|
||||
import com.alibaba.nacos.client.utils.LogUtils;
|
||||
import com.alibaba.nacos.client.utils.ParamUtil;
|
||||
import com.alibaba.nacos.client.utils.StringUtils;
|
||||
import com.alibaba.nacos.client.utils.TemplateUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
/**
|
||||
* Serverlist Manager
|
||||
@ -284,8 +294,7 @@ public class ServerListManager {
|
||||
List<String> lines = IOUtils.readLines(new StringReader(httpResult.content));
|
||||
List<String> result = new ArrayList<String>(lines.size());
|
||||
for (String serverAddr : lines) {
|
||||
if (null == serverAddr || serverAddr.trim().isEmpty()) {
|
||||
} else {
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(serverAddr)) {
|
||||
String[] ipPort = serverAddr.trim().split(":");
|
||||
String ip = ipPort[0].trim();
|
||||
if (ipPort.length == 1) {
|
||||
|
@ -43,9 +43,7 @@ public class ParamUtils {
|
||||
int length = param.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
char ch = param.charAt(i);
|
||||
if (Character.isLetterOrDigit(ch)) {
|
||||
} else if (isValidChar(ch)) {
|
||||
} else {
|
||||
if (!Character.isLetterOrDigit(ch) && !isValidChar(ch)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,20 @@
|
||||
*/
|
||||
package com.alibaba.nacos.config.server.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.nacos.config.server.constant.Constants;
|
||||
import com.alibaba.nacos.config.server.monitor.MetricsMonitor;
|
||||
import com.alibaba.nacos.config.server.service.notify.NotifyService;
|
||||
@ -23,6 +37,7 @@ import com.alibaba.nacos.config.server.utils.LogUtil;
|
||||
import com.alibaba.nacos.config.server.utils.PropertyUtil;
|
||||
import com.alibaba.nacos.config.server.utils.RunningConfigUtils;
|
||||
import com.alibaba.nacos.config.server.utils.event.EventDispatcher;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
@ -39,20 +54,11 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
|
||||
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;
|
||||
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;
|
||||
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
|
||||
import static com.alibaba.nacos.core.utils.SystemUtils.readClusterConf;
|
||||
import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
|
||||
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;
|
||||
|
||||
/**
|
||||
* Serverlist service
|
||||
@ -261,8 +267,7 @@ public class ServerListService implements ApplicationListener<WebServerInitializ
|
||||
List<String> lines = IOUtils.readLines(new StringReader(result.content));
|
||||
List<String> ips = new ArrayList<String>(lines.size());
|
||||
for (String serverAddr : lines) {
|
||||
if (null == serverAddr || serverAddr.trim().isEmpty()) {
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(serverAddr)) {
|
||||
ips.add(getFormatServerAddr(serverAddr));
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,12 @@
|
||||
*/
|
||||
package com.alibaba.nacos.config.server.utils;
|
||||
|
||||
import com.alibaba.nacos.config.server.exception.NacosException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.nacos.config.server.exception.NacosException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 参数合法性检查工具类
|
||||
*
|
||||
@ -46,9 +47,7 @@ public class ParamUtils {
|
||||
int length = param.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
char ch = param.charAt(i);
|
||||
if (Character.isLetterOrDigit(ch)) {
|
||||
} else if (isValidChar(ch)) {
|
||||
} else {
|
||||
if (!Character.isLetterOrDigit(ch) && !isValidChar(ch)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user