Commit f349304a authored by shangying's avatar shangying

sonar问题修改11

parent db0e7263
......@@ -114,6 +114,9 @@ public class EnvUtil {
for (Map.Entry<Object, Object> property : propertySet) {
String propertyKey = property.getKey().toString();
String lowerCase=ciEnv.toLowerCase();
if(StringUtils.isBlank(lowerCase)){
return env;
}
if (propertyKey.toLowerCase().contains(String.format("dubbo.%s.%s.",siteName.toLowerCase(),lowerCase))) {
// �������÷���
env = propertyKey.split("\\.")[2];
......@@ -139,6 +142,9 @@ public class EnvUtil {
for (Map.Entry<Object, Object> property : propertySet) {
String propertyKey = property.getKey().toString();
String lowerCase=ciEnv.toLowerCase();
if(StringUtils.isBlank(lowerCase)){
return env;
}
if (propertyKey.toLowerCase().contains(String.format("http.%s.%s.",siteName.toLowerCase(),lowerCase))) {
// �������÷���,�����ַ�������Сд
env = propertyKey.split("\\.")[2];
......
......@@ -189,19 +189,12 @@ public class HttpService {
}else {
result = doResponse(response, urlString);
// 得到响应状态码
int statuCode = response.getStatusLine().getStatusCode();
if(!Objects.isNull(statuCode)){
resultEntity.setStatusCode(statuCode);
}else {
log.info("返回的数据有问题statuCode={}",statuCode);
}
resultEntity.setResponseString(result);
resultEntity.setCookies(cookieStore.getCookies());
if(!Objects.isNull(response.getStatusLine())) {
resultEntity.setStatusCode(response.getStatusLine().getStatusCode());
}
resultEntity.setResponseString(result);
resultEntity.setCookies(cookieStore.getCookies());
}
} catch (MalformedURLException e) {
......@@ -220,15 +213,13 @@ public class HttpService {
if (response != null) {
try {
response.close();
httpGet.abort();
} catch (IOException e) {
// e.printStackTrace();
log.info("异常信息e={}",e);
}
}
if(!Objects.isNull(httpGet)){
httpGet.abort();
}
}
......@@ -299,16 +290,16 @@ public class HttpService {
return resultEntity;
}else {
result = doResponse(response, url);
resultEntity.setResponseString(result);
resultEntity.setCookies(cookieStore.getCookies());
if(!Objects.isNull(response.getStatusLine()) ) {
resultEntity.setStatusCode(response.getStatusLine().getStatusCode());
}
resultEntity.setResponseString(result);
resultEntity.setCookies(cookieStore.getCookies());
}
} catch (Exception ex) {
ex.printStackTrace();
// ex.printStackTrace();
log.info("异常信息ex={}",ex);
}
return resultEntity;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment